chaindb: endianness.
This commit is contained in:
parent
096957ccb9
commit
e817b89653
@ -165,17 +165,13 @@ var layout = {
|
||||
key[0] = 0x9a; // W + C
|
||||
write(key, address, 1);
|
||||
write(key, hash, 33);
|
||||
// TODO: Change this to big
|
||||
// endian for saner sorting.
|
||||
key.writeUInt32LE(index, 65, true);
|
||||
key.writeUInt32BE(index, 65, true);
|
||||
} else {
|
||||
key = new Buffer(57);
|
||||
key[0] = 0x43; // C
|
||||
write(key, address, 1);
|
||||
write(key, hash, 21);
|
||||
// TODO: Change this to big
|
||||
// endian for saner sorting.
|
||||
key.writeUInt32LE(index, 53, true);
|
||||
key.writeUInt32BE(index, 53, true);
|
||||
}
|
||||
|
||||
return key;
|
||||
@ -185,10 +181,10 @@ var layout = {
|
||||
|
||||
if (key.length === 69) {
|
||||
hash = key.slice(33, 65).toString('hex');
|
||||
index = key.readUInt32LE(65, 0);
|
||||
index = key.readUInt32BE(65, 0);
|
||||
} else {
|
||||
hash = key.slice(21, 53).toString('hex');
|
||||
index = key.readUInt32LE(53, 0);
|
||||
index = key.readUInt32BE(53, 0);
|
||||
}
|
||||
|
||||
return [hash, index];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user