Lines Matching +full:odd +full:- +full:parity

1 /* SPDX-License-Identifier: GPL-2.0 */
25 * Defined here because those may be needed by architecture-specific static
29 #include <asm-generic/bitops/generic-non-atomic.h>
32 * Many architecture-specific non-atomic bitops contain inline asm code and due
33 * to that the compiler can't optimize them to compile-time expressions or
40 * The casts to `uintptr_t` are needed to mitigate `-Waddress` warnings when
41 * passing a bitmap from .bss or .data (-> `!!addr` is always true).
51 * The following macros are non-atomic versions of their non-underscored
92 return order; /* We could be slightly more clever with -1 here... */ in get_bitmask_order()
101 * rol64 - rotate a 64-bit value left
107 return (word << (shift & 63)) | (word >> ((-shift) & 63)); in rol64()
111 * ror64 - rotate a 64-bit value right
117 return (word >> (shift & 63)) | (word << ((-shift) & 63)); in ror64()
121 * rol32 - rotate a 32-bit value left
127 return (word << (shift & 31)) | (word >> ((-shift) & 31)); in rol32()
131 * ror32 - rotate a 32-bit value right
137 return (word >> (shift & 31)) | (word << ((-shift) & 31)); in ror32()
141 * rol16 - rotate a 16-bit value left
147 return (word << (shift & 15)) | (word >> ((-shift) & 15)); in rol16()
151 * ror16 - rotate a 16-bit value right
157 return (word >> (shift & 15)) | (word << ((-shift) & 15)); in ror16()
161 * rol8 - rotate an 8-bit value left
167 return (word << (shift & 7)) | (word >> ((-shift) & 7)); in rol8()
171 * ror8 - rotate an 8-bit value right
177 return (word >> (shift & 7)) | (word << ((-shift) & 7)); in ror8()
181 * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit
185 * This is safe to use for 16- and 8-bit types as well.
189 __u8 shift = 31 - index; in sign_extend32()
194 * sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit
200 __u8 shift = 63 - index; in sign_extend64()
214 return -1; in get_count_order()
216 return fls(--count); in get_count_order()
220 * get_count_order_long - get order after rounding @l up to power of 2
228 return -1; in get_count_order_long()
229 return (int)fls_long(--l); in get_count_order_long()
233 * parity8 - get the parity of an u8 value
236 * Determine the parity of the u8 argument.
239 * 0 for even parity, 1 for odd parity
241 * Note: This function informs you about the current parity. Example to bail
242 * out when parity is odd:
245 * return -EBADMSG;
247 * If you need to calculate a parity bit, you need to draw the conclusion from
248 * this result yourself. Example to enforce odd parity, parity bit is bit 7:
257 * https://funloop.org/codex/problem/parity/README.html in parity8()
264 * __ffs64 - find first set bit in a 64 bit word
269 * is non-zero before calling this.
283 * fns - find N'th set bit in a word
289 while (word && n--) in fns()
290 word &= word - 1; in fns()
296 * assign_bit - Assign value to a bit in memory
308 * __ptr_set_bit - Set bit in a pointer's value
323 * __ptr_clear_bit - Clear bit in a pointer's value
338 * __ptr_test_bit - Test bit in a pointer's value