mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
Make dc_tools::dc_exactly_one_bit_set safe and return bool
This commit is contained in:
committed by
Floris Bruynooghe
parent
3eaab07b0b
commit
6c818c6123
@@ -570,13 +570,13 @@ pub unsafe fn dc_job_do_DC_JOB_CONFIGURE_IMAP(context: &Context, _job: *mut dc_j
|
||||
{
|
||||
param.send_pw = param.mail_pw.clone()
|
||||
}
|
||||
if 0 == dc_exactly_one_bit_set(
|
||||
if !dc_exactly_one_bit_set(
|
||||
param.server_flags & (0x2 | 0x4),
|
||||
) {
|
||||
param.server_flags &= !(0x2 | 0x4);
|
||||
param.server_flags |= 0x4
|
||||
}
|
||||
if 0 == dc_exactly_one_bit_set(
|
||||
if !dc_exactly_one_bit_set(
|
||||
param.server_flags & (0x100 | 0x200 | 0x400),
|
||||
) {
|
||||
param.server_flags &= !(0x100 | 0x200 | 0x400);
|
||||
@@ -586,7 +586,7 @@ pub unsafe fn dc_job_do_DC_JOB_CONFIGURE_IMAP(context: &Context, _job: *mut dc_j
|
||||
0x200
|
||||
}
|
||||
}
|
||||
if 0 == dc_exactly_one_bit_set(
|
||||
if !dc_exactly_one_bit_set(
|
||||
param.server_flags & (0x10000 | 0x20000 | 0x40000),
|
||||
) {
|
||||
param.server_flags &=
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user