More QOL updates
This commit is contained in:
parent
9b7b84153f
commit
7d75a2b5f8
2 changed files with 10 additions and 16 deletions
|
@ -344,7 +344,8 @@ class ByteLayer {
|
|||
_position = position;
|
||||
}
|
||||
|
||||
void waitSetBit(int position, int maskToClear, int maskToSet) {
|
||||
/// Unsets a mask, then sets a mask
|
||||
void unsetSetBit(int position, int maskToClear, int maskToSet) {
|
||||
clearBit(position, maskToClear);
|
||||
setBit(position, maskToSet);
|
||||
|
||||
|
|
|
@ -9,15 +9,8 @@ class UUID {
|
|||
late final int MSB;
|
||||
|
||||
UUID(int msb, int lsb) {
|
||||
if (msb < 0)
|
||||
MSB = -msb;
|
||||
else
|
||||
MSB = msb;
|
||||
|
||||
if (lsb < 0)
|
||||
LSB = -lsb;
|
||||
else
|
||||
LSB = lsb;
|
||||
MSB = msb.abs();
|
||||
LSB = lsb.abs();
|
||||
}
|
||||
|
||||
static final UUID ZERO = UUID.generate(0);
|
||||
|
@ -100,8 +93,8 @@ class UUID {
|
|||
layer.clear();
|
||||
layer.writeBytes(bytes);
|
||||
|
||||
layer.waitSetBit(6, 0x0F, 0x30);
|
||||
layer.waitSetBit(8, 0x3F, 0x80);
|
||||
layer.unsetSetBit(6, 0x0F, 0x30);
|
||||
layer.unsetSetBit(8, 0x3F, 0x80);
|
||||
|
||||
layer.resetPosition();
|
||||
|
||||
|
@ -117,8 +110,8 @@ class UUID {
|
|||
layer.writeLong(
|
||||
(random.nextInt(0xFFFFFFFF) << 32) | random.nextInt(0xFFFFFFFF));
|
||||
|
||||
layer.waitSetBit(6, 0x0F, 0x40);
|
||||
layer.waitSetBit(8, 0x3F, 0x80);
|
||||
layer.unsetSetBit(6, 0x0F, 0x40);
|
||||
layer.unsetSetBit(8, 0x3F, 0x80);
|
||||
|
||||
layer.resetPosition();
|
||||
|
||||
|
@ -147,8 +140,8 @@ class UUID {
|
|||
layer.clear();
|
||||
layer.writeBytes(hashBytes);
|
||||
|
||||
layer.waitSetBit(6, 0x0F, 0x50);
|
||||
layer.waitSetBit(8, 0x3F, 0x80);
|
||||
layer.unsetSetBit(6, 0x0F, 0x50);
|
||||
layer.unsetSetBit(8, 0x3F, 0x80);
|
||||
|
||||
layer.resetPosition();
|
||||
|
||||
|
|
Loading…
Reference in a new issue