hotspot/src/share/vm/utilities/globalDefinitions.hpp
changeset 37056 109f610020fa
parent 36581 8d65a7db1582
child 37092 0e56e3c9d545
equal deleted inserted replaced
37054:31d83caf01e8 37056:109f610020fa
  1081 const jlong    NoLongBits =  0; // no bits set in a long
  1081 const jlong    NoLongBits =  0; // no bits set in a long
  1082 const intptr_t OneBit     =  1; // only right_most bit set in a word
  1082 const intptr_t OneBit     =  1; // only right_most bit set in a word
  1083 
  1083 
  1084 // get a word with the n.th or the right-most or left-most n bits set
  1084 // get a word with the n.th or the right-most or left-most n bits set
  1085 // (note: #define used only so that they can be used in enum constant definitions)
  1085 // (note: #define used only so that they can be used in enum constant definitions)
  1086 #define nth_bit(n)        (n >= BitsPerWord ? 0 : OneBit << (n))
  1086 #define nth_bit(n)        (((n) >= BitsPerWord) ? 0 : (OneBit << (n)))
  1087 #define right_n_bits(n)   (nth_bit(n) - 1)
  1087 #define right_n_bits(n)   (nth_bit(n) - 1)
  1088 #define left_n_bits(n)    (right_n_bits(n) << (n >= BitsPerWord ? 0 : (BitsPerWord - n)))
  1088 #define left_n_bits(n)    (right_n_bits(n) << (((n) >= BitsPerWord) ? 0 : (BitsPerWord - (n))))
  1089 
  1089 
  1090 // bit-operations using a mask m
  1090 // bit-operations using a mask m
  1091 inline void   set_bits    (intptr_t& x, intptr_t m) { x |= m; }
  1091 inline void   set_bits    (intptr_t& x, intptr_t m) { x |= m; }
  1092 inline void clear_bits    (intptr_t& x, intptr_t m) { x &= ~m; }
  1092 inline void clear_bits    (intptr_t& x, intptr_t m) { x &= ~m; }
  1093 inline intptr_t mask_bits      (intptr_t  x, intptr_t m) { return x & m; }
  1093 inline intptr_t mask_bits      (intptr_t  x, intptr_t m) { return x & m; }