Make dc_tools::dc_exactly_one_bit_set safe and return bool

This commit is contained in:
Alexander Krotov
2019-07-28 21:07:49 +03:00
committed by Floris Bruynooghe
parent 3eaab07b0b
commit 6c818c6123
2 changed files with 5 additions and 5 deletions

View File

@@ -20,8 +20,8 @@ no references to Context and other "larger" classes here. */
// for carray etc.
/* ** library-private **********************************************************/
/* math tools */
pub unsafe fn dc_exactly_one_bit_set(v: libc::c_int) -> libc::c_int {
return (0 != v && 0 == v & v - 1i32) as libc::c_int;
pub fn dc_exactly_one_bit_set(v: libc::c_int) -> bool {
0 != v && 0 == v & v - 1i32
}
/* string tools */