static void assert_params_aligned(HeapWord* from, HeapWord* to) { #ifdef ASSERT if (mask_bits((uintptr_t)from, MinObjAlignmentInBytes-1) != 0) basic_fatal("not object aligned"); if (mask_bits((uintptr_t)to, MinObjAlignmentInBytes-1) != 0) basic_fatal("not object aligned"); #endif }
static void assert_params_ok(void* from, void* to, intptr_t log_align) { #ifdef ASSERT if (mask_bits((uintptr_t)from, right_n_bits(log_align)) != 0) basic_fatal("not aligned"); if (mask_bits((uintptr_t)to, right_n_bits(log_align)) != 0) basic_fatal("not aligned"); #endif }
void IPPrefix::normalize() { /* * Zero-out the bits that were outside the length so we can store * in a 'normalized' way, which makes comparisons easier. */ switch (family_) { case AF_INET: mask_bits((unsigned char*)&address_, sizeof(address_.addr4), length_); break; case AF_INET6: mask_bits((unsigned char*)&address_, sizeof(address_.addr6), length_); break; } }
// returns integer round-down to the nearest multiple of s (s must be a power of two) inline intptr_t round_down(intptr_t x, uintx s) { #ifdef ASSERT if (!is_power_of_2(s)) basic_fatal("s must be a power of 2"); #endif const uintx m = s - 1; return mask_bits(x, ~m); }
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { #ifdef _LP64 guarantee(mask_bits((uintptr_t)tohw, right_n_bits(LogBytesPerLong)) == 0, "unaligned fill words"); julong* to = (julong*)tohw; julong v = ((julong)value << 32) | value; while (count-- > 0) { *to++ = v; } #else // _LP64 juint* to = (juint*)tohw; while (count-- > 0) { *to++ = value; } #endif // _LP64 }
static uint get_bit_index(uint element) { return mask_bits(element,bit_index_mask); }
// true if x is a power of 2, false otherwise inline bool is_power_of_2(intptr_t x) { return ((x != NoBits) && (mask_bits(x, x - 1) == NoBits)); }
inline bool is_set_nth_bit(intptr_t x, int n) { return mask_bits (x, nth_bit(n)) != NoBits; }
void show_registers(struct pt_regs *regs) { char *mode; mode = user_mode(regs) ? "User" : "Krnl"; printk("%s PSW : %p %p (%pSR)\n", mode, (void *) regs->psw.mask, (void *) regs->psw.addr, (void *) regs->psw.addr); printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x " "P:%x AS:%x CC:%x PM:%x", mask_bits(regs, PSW_MASK_PER), mask_bits(regs, PSW_MASK_DAT), mask_bits(regs, PSW_MASK_IO), mask_bits(regs, PSW_MASK_EXT), mask_bits(regs, PSW_MASK_KEY), mask_bits(regs, PSW_MASK_MCHECK), mask_bits(regs, PSW_MASK_WAIT), mask_bits(regs, PSW_MASK_PSTATE), mask_bits(regs, PSW_MASK_ASC), mask_bits(regs, PSW_MASK_CC), mask_bits(regs, PSW_MASK_PM)); #ifdef CONFIG_64BIT printk(" EA:%x", mask_bits(regs, PSW_MASK_EA | PSW_MASK_BA)); #endif printk("\n%s GPRS: " FOURLONG, mode, regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]); printk(" " FOURLONG, regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]); printk(" " FOURLONG, regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]); printk(" " FOURLONG, regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]); show_code(regs); }
bool ciMethodData::eflag_set(MethodData::EscapeFlag f) const { return mask_bits(_eflags, f) != 0; }