operator ~ method

T operator ~()

Implementation

T operator ~() {
  // we need to hack a little bit here since a normal
  //int inverted is not equal to inverting a 8 bit int!

  final int value = this.value;

  // The in the compiler generated mask (negationMask)
  //with all 1 except e.g the 8 lsb
  // Example Bit view: 1 1 1 .... 1 1 1 0 0 0 0 0 0 0 0

  // or the mask and value to get some thing like the following
  // (example for `value` = 127 = 0 1 1 1 1 1 1 1)
  // Bit view: 1 1 1 .... 1 1 1 0 1 1 1 1 1 1 1
  final int tmp = negationMask | value;

  // now we can just negate like we would do normally
  return constructorCallback(~tmp);
}