Push unsigned read methods
This commit is contained in:
parent
d4cf453005
commit
f8918b9fcf
2 changed files with 41 additions and 12 deletions
|
@ -94,11 +94,20 @@ class UUID {
|
|||
layer.writeBytes(bytes);
|
||||
|
||||
layer.unsetSetBit(6, 0x0F, 0x30);
|
||||
print(
|
||||
"Existing bit at position 8: ${layer.getBit(8).toRadixString(2)}:${layer.getBit(8)}");
|
||||
layer.unsetSetBit(8, 0x3F, 0x80);
|
||||
print(
|
||||
"New bit at position 8: ${layer.getBit(8).toRadixString(2)}:${layer.getBit(8)}");
|
||||
|
||||
layer.resetPosition();
|
||||
|
||||
return UUID(layer.readLong(), layer.readLong());
|
||||
var msb = layer.readUnsignedLong();
|
||||
var lsb = layer.readUnsignedLong();
|
||||
|
||||
if (msb < 0) print("Most significant bit is negative!");
|
||||
if (lsb < 0) print("Least significant bit is negative!");
|
||||
return UUID(msb, lsb);
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
|
@ -115,7 +124,7 @@ class UUID {
|
|||
|
||||
layer.resetPosition();
|
||||
|
||||
return UUID(layer.readLong(), layer.readLong());
|
||||
return UUID(layer.readUnsignedLong(), layer.readUnsignedLong());
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
|
@ -145,7 +154,7 @@ class UUID {
|
|||
|
||||
layer.resetPosition();
|
||||
|
||||
return UUID(layer.readLong(), layer.readLong());
|
||||
return UUID(layer.readUnsignedLong(), layer.readUnsignedLong());
|
||||
}
|
||||
default:
|
||||
throw ArgumentError('Unsupported UUID version: $version');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue