final static boolean fits (int val, int bits) {
final static boolean fits (long val, int bits) {
  final static boolean fits (int val, int bits) {    val = val >> bits-1;    return (val == 0 || val == -1);  }