getInt64 method

dynamic getInt64()

Implementation

getInt64() {

	var low, high;

	if ( this.littleEndian ) {

		low = this.getUint32();
		high = this.getUint32();

	} else {

		high = this.getUint32();
		low = this.getUint32();

	}

	// calculate negative value
	if ( (high & 0x80000000) > 0) {

		high = ~ high & 0xFFFFFFFF;
		low = ~ low & 0xFFFFFFFF;

		if ( low == 0xFFFFFFFF ) high = ( high + 1 ) & 0xFFFFFFFF;

		low = ( low + 1 ) & 0xFFFFFFFF;

		return - ( high * 0x100000000 + low );

	}

	return high * 0x100000000 + low;

}