How to use the long.MIN_VALUE function in long

To help you get started, we’ve selected a few long examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kagami / wasm-polyfill.js / src / translate / funcode.js View on Github external
i64_binaryFunc(f, "i64_sub")
        break

      case OPCODES.I64_MUL:
        i64_binaryFunc(f, "i64_mul")
        break

      case OPCODES.I64_DIV_S:
        // Spill both sides to tempvars, so we can add trap conditions.
        var rhs = f.cfStack.popValue(TYPES.I64)
        var lhs = f.cfStack.spillValueIfComposite()
        f.cfStack.pushValue(rhs)
        rhs = f.cfStack.spillValueIfComposite()
        f.cfStack.addTrapCondition(new I64Eqz(rhs))
        f.cfStack.addTrapCondition(new I32BinOp('&', 
          new I64CompareFunc('i64_eq', lhs, new I64Constant(Long.MIN_VALUE)),
          new I64CompareFunc('i64_eq', rhs, new I64Constant(Long.NEG_ONE))
        ))
        i64_binaryFunc(f, "i64_div_s")
        break

      case OPCODES.I64_DIV_U:
        var rhs = f.cfStack.spillValueIfComposite()
        f.cfStack.addTrapCondition(new I64Eqz(rhs))
        i64_binaryFunc(f, "i64_div_u")
        break

      case OPCODES.I64_REM_S:
        var rhs = f.cfStack.spillValueIfComposite()
        f.cfStack.addTrapCondition(new I64Eqz(rhs))
        i64_binaryFunc(f, "i64_rem_s")
        break
github gd-com / utils / test / library.spec.js View on Github external
it('should encode/decode int 64', () => {
    const values = [Long.MAX_VALUE.toString(), Long.MIN_VALUE.toString(), '10', '518']
    values.forEach((value) => {
      const encoded = GdCom.put64(value)
      const decoded = GdCom.get64(encoded)
      expect(decoded.value).to.be.equal(value)
    })
  })
github node-modules / node-biginteger / lib / MutableBigInteger.js View on Github external
MutableBigInteger.prototype.unsignedLongCompare = function (one, two) {
  return one.add(Long.MIN_VALUE).compare(two.add(Long.MIN_VALUE)) > 0;
}
github stellar / js-xdr / src / unsigned-hyper.js View on Github external
}

  constructor(low, high) {
    super(low, high, true);
  }
}

includeIoMixin(UnsignedHyper);

UnsignedHyper.MAX_VALUE = new UnsignedHyper(
  Long.MAX_UNSIGNED_VALUE.low,
  Long.MAX_UNSIGNED_VALUE.high
);

UnsignedHyper.MIN_VALUE = new UnsignedHyper(
  Long.MIN_VALUE.low,
  Long.MIN_VALUE.high
);
github stellar / js-xdr / src / hyper.js View on Github external
return new this(result.low, result.high);
  }

  static isValid(value) {
    return value instanceof this;
  }

  constructor(low, high) {
    super(low, high, false);
  }
}

includeIoMixin(Hyper);

Hyper.MAX_VALUE = new Hyper(Long.MAX_VALUE.low, Long.MAX_VALUE.high);
Hyper.MIN_VALUE = new Hyper(Long.MIN_VALUE.low, Long.MIN_VALUE.high);
github alibaba / node-hbase-client / lib / hconstants.js View on Github external
var CONST = {};

CONST.PROTOCOL = 'org.apache.hadoop.hbase.ipc.HRegionInterface';
CONST.CLIENT_VERSION = Long.fromNumber(29);

/**
 * Timestamp to use when we want to refer to the latest cell.
 * This is the timestamp sent by clients when no timestamp is specified on
 * commit.
 */
CONST.LATEST_TIMESTAMP = Long.MAX_VALUE;
/**
 * Timestamp to use when we want to refer to the oldest cell.
 */
CONST.OLDEST_TIMESTAMP = Long.MIN_VALUE;
/**
 * LATEST_TIMESTAMP in bytes form
 */
CONST.LATEST_TIMESTAMP_BYTES = Bytes.toBytes(CONST.LATEST_TIMESTAMP);
/** The root table's name.*/
CONST.ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-");
CONST.ROOT_TABLE_NAME.__name__ = '-ROOT-';

/** The META table's name. */
CONST.META_TABLE_NAME = Bytes.toBytes(".META.");
CONST.META_TABLE_NAME.__name__ = '.META.';

/** delimiter used between portions of a region name */
CONST.META_ROW_DELIMITER = ',';

/** The catalog family as a string*/
github tulios / kafkajs / src / protocol / encoder.spec.js View on Github external
expect(signed64(L('-281474976710657'))).toEqual(
        B(0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1)
      )
      expect(signed64(L('-36028797018963968'))).toEqual(
        B(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f)
      )
      expect(signed64(L('-36028797018963969'))).toEqual(
        B(0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01)
      )
      expect(signed64(L('-4611686018427387904'))).toEqual(
        B(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f)
      )
      expect(signed64(L('-4611686018427387905'))).toEqual(
        B(0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01)
      )
      expect(signed64(Long.MIN_VALUE)).toEqual(
        B(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01)
      )
    })
github stellar / js-xdr / src / unsigned-hyper.js View on Github external
constructor(low, high) {
    super(low, high, true);
  }
}

includeIoMixin(UnsignedHyper);

UnsignedHyper.MAX_VALUE = new UnsignedHyper(
  Long.MAX_UNSIGNED_VALUE.low,
  Long.MAX_UNSIGNED_VALUE.high
);

UnsignedHyper.MIN_VALUE = new UnsignedHyper(
  Long.MIN_VALUE.low,
  Long.MIN_VALUE.high
);