Lines Matching defs:X
31 inline constexpr bool isPowerOfTwo(uptr X) {
32 if (X == 0)
34 return (X & (X - 1)) == 0;
37 inline constexpr uptr roundUp(uptr X, uptr Boundary) {
39 return (X + Boundary - 1) & ~(Boundary - 1);
41 inline constexpr uptr roundUpSlow(uptr X, uptr Boundary) {
42 return ((X + Boundary - 1) / Boundary) * Boundary;
45 inline constexpr uptr roundDown(uptr X, uptr Boundary) {
47 return X & ~(Boundary - 1);
49 inline constexpr uptr roundDownSlow(uptr X, uptr Boundary) {
50 return (X / Boundary) * Boundary;
53 inline constexpr bool isAligned(uptr X, uptr Alignment) {
55 return (X & (Alignment - 1)) == 0;
57 inline constexpr bool isAlignedSlow(uptr X, uptr Alignment) {
58 return X % Alignment == 0;
71 inline uptr getMostSignificantSetBitIndex(uptr X) {
72 DCHECK_NE(X, 0U);
73 return SCUDO_WORDSIZE - 1U - static_cast<uptr>(__builtin_clzl(X));
86 inline uptr getLeastSignificantSetBitIndex(uptr X) {
87 DCHECK_NE(X, 0U);
88 return static_cast<uptr>(__builtin_ctzl(X));
91 inline uptr getLog2(uptr X) {
92 DCHECK(isPowerOfTwo(X));
93 return getLeastSignificantSetBitIndex(X);