setInt64LE function
Writes a little-endian int64 at offset. See getInt64LE for the
per-compiler contract.
Implementation
void setInt64LE(ByteData data, int offset, int value) {
if (kNitroWeb) {
// Arithmetic, not bitwise: dart2js truncates bitwise operands to 32 bits,
// and double division would lose precision for big int64s on dart2wasm.
// Dart's % is non-negative for a positive divisor, so lo is the unsigned
// low half and (value - lo) is exactly divisible.
final lo = value % 0x100000000;
final hi = (value - lo) ~/ 0x100000000;
data.setUint32(offset, lo, Endian.little);
data.setInt32(offset + 4, hi, Endian.little);
return;
}
data.setInt64(offset, value, Endian.little);
}