Skip to content

Commit bfab71c

Browse files
VelkarasStructed
authored andcommitted
refactor: fixing tabs again
1 parent 7fb5dbc commit bfab71c

File tree

1 file changed

+70
-70
lines changed
  • addons/godot-playfab/lib/binogure-studio/godot-uuid

1 file changed

+70
-70
lines changed

addons/godot-playfab/lib/binogure-studio/godot-uuid/uuid.gd

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,109 +5,109 @@ class_name UUID extends Node
55
const BYTE_MASK: int = 0b11111111
66

77
static func uuidbin():
8-
randomize()
8+
randomize()
99
# 16 random bytes with the bytes on index 6 and 8 modified
10-
return [
11-
randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK,
12-
randi() & BYTE_MASK, randi() & BYTE_MASK, ((randi() & BYTE_MASK) & 0x0f) | 0x40, randi() & BYTE_MASK,
13-
((randi() & BYTE_MASK) & 0x3f) | 0x80, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK,
14-
randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK,
10+
return [
11+
randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK,
12+
randi() & BYTE_MASK, randi() & BYTE_MASK, ((randi() & BYTE_MASK) & 0x0f) | 0x40, randi() & BYTE_MASK,
13+
((randi() & BYTE_MASK) & 0x3f) | 0x80, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK,
14+
randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK, randi() & BYTE_MASK,
1515
]
1616

1717
static func uuidbinrng(rng: RandomNumberGenerator):
18-
rng.randomize()
19-
return [
20-
rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK,
21-
rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, ((rng.randi() & BYTE_MASK) & 0x0f) | 0x40, rng.randi() & BYTE_MASK,
22-
((rng.randi() & BYTE_MASK) & 0x3f) | 0x80, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK,
23-
rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK,
18+
rng.randomize()
19+
return [
20+
rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK,
21+
rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, ((rng.randi() & BYTE_MASK) & 0x0f) | 0x40, rng.randi() & BYTE_MASK,
22+
((rng.randi() & BYTE_MASK) & 0x3f) | 0x80, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK,
23+
rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK, rng.randi() & BYTE_MASK,
2424
]
2525

2626
static func v4():
2727
# 16 random bytes with the bytes on index 6 and 8 modified
28-
var b = uuidbin()
29-
return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [
30-
# low
31-
b[0], b[1], b[2], b[3],
28+
var b = uuidbin()
29+
return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [
30+
# low
31+
b[0], b[1], b[2], b[3],
3232

33-
# mid
34-
b[4], b[5],
33+
# mid
34+
b[4], b[5],
3535

36-
# hi
37-
b[6], b[7],
36+
# hi
37+
b[6], b[7],
3838

39-
# clock
40-
b[8], b[9],
39+
# clock
40+
b[8], b[9],
4141

42-
# clock
43-
b[10], b[11], b[12], b[13], b[14], b[15]
44-
]
42+
# clock
43+
b[10], b[11], b[12], b[13], b[14], b[15]
44+
]
4545

4646
static func v4_rng(rng: RandomNumberGenerator):
4747
# 16 random bytes with the bytes on index 6 and 8 modified
48-
var b = uuidbinrng(rng)
49-
return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [
50-
# low
51-
b[0], b[1], b[2], b[3],
48+
var b = uuidbinrng(rng)
49+
return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [
50+
# low
51+
b[0], b[1], b[2], b[3],
5252

53-
# mid
54-
b[4], b[5],
53+
# mid
54+
b[4], b[5],
5555

56-
# hi
57-
b[6], b[7],
56+
# hi
57+
b[6], b[7],
5858

59-
# clock
60-
b[8], b[9],
59+
# clock
60+
b[8], b[9],
6161

62-
# clock
63-
b[10], b[11], b[12], b[13], b[14], b[15]
64-
]
62+
# clock
63+
b[10], b[11], b[12], b[13], b[14], b[15]
64+
]
6565

6666
var _uuid: Array
6767

6868
func _init(rng := RandomNumberGenerator.new()) -> void:
69-
_uuid = uuidbinrng(rng)
69+
_uuid = uuidbinrng(rng)
7070

7171
func as_array() -> Array:
72-
return _uuid.duplicate()
72+
return _uuid.duplicate()
7373

7474
func as_dict(big_endian := true) -> Dictionary:
75-
if big_endian:
76-
return {
77-
"low" : (_uuid[0] << 24) + (_uuid[1] << 16) + (_uuid[2] << 8 ) + _uuid[3],
78-
"mid" : (_uuid[4] << 8 ) + _uuid[5],
79-
"hi" : (_uuid[6] << 8 ) + _uuid[7],
80-
"clock": (_uuid[8] << 8 ) + _uuid[9],
81-
"node" : (_uuid[10] << 40) + (_uuid[11] << 32) + (_uuid[12] << 24) + (_uuid[13] << 16) + (_uuid[14] << 8 ) + _uuid[15]
82-
}
83-
else:
84-
return {
85-
"low" : _uuid[0] + (_uuid[1] << 8 ) + (_uuid[2] << 16) + (_uuid[3] << 24),
86-
"mid" : _uuid[4] + (_uuid[5] << 8 ),
87-
"hi" : _uuid[6] + (_uuid[7] << 8 ),
88-
"clock": _uuid[8] + (_uuid[9] << 8 ),
89-
"node" : _uuid[10] + (_uuid[11] << 8 ) + (_uuid[12] << 16) + (_uuid[13] << 24) + (_uuid[14] << 32) + (_uuid[15] << 40)
90-
}
91-
75+
if big_endian:
76+
return {
77+
"low" : (_uuid[0] << 24) + (_uuid[1] << 16) + (_uuid[2] << 8 ) + _uuid[3],
78+
"mid" : (_uuid[4] << 8 ) + _uuid[5],
79+
"hi" : (_uuid[6] << 8 ) + _uuid[7],
80+
"clock": (_uuid[8] << 8 ) + _uuid[9],
81+
"node" : (_uuid[10] << 40) + (_uuid[11] << 32) + (_uuid[12] << 24) + (_uuid[13] << 16) + (_uuid[14] << 8 ) + _uuid[15]
82+
}
83+
else:
84+
return {
85+
"low" : _uuid[0] + (_uuid[1] << 8 ) + (_uuid[2] << 16) + (_uuid[3] << 24),
86+
"mid" : _uuid[4] + (_uuid[5] << 8 ),
87+
"hi" : _uuid[6] + (_uuid[7] << 8 ),
88+
"clock": _uuid[8] + (_uuid[9] << 8 ),
89+
"node" : _uuid[10] + (_uuid[11] << 8 ) + (_uuid[12] << 16) + (_uuid[13] << 24) + (_uuid[14] << 32) + (_uuid[15] << 40)
90+
}
91+
9292
func as_string() -> String:
93-
return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [
94-
# low
95-
_uuid[0], _uuid[1], _uuid[2], _uuid[3],
93+
return '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % [
94+
# low
95+
_uuid[0], _uuid[1], _uuid[2], _uuid[3],
9696

97-
# mid
98-
_uuid[4], _uuid[5],
97+
# mid
98+
_uuid[4], _uuid[5],
9999

100-
# hi
101-
_uuid[6], _uuid[7],
100+
# hi
101+
_uuid[6], _uuid[7],
102102

103-
# clock
104-
_uuid[8], _uuid[9],
103+
# clock
104+
_uuid[8], _uuid[9],
105105

106-
# node
107-
_uuid[10], _uuid[11], _uuid[12], _uuid[13], _uuid[14], _uuid[15]
108-
]
106+
# node
107+
_uuid[10], _uuid[11], _uuid[12], _uuid[13], _uuid[14], _uuid[15]
108+
]
109109

110110
func is_equal(other) -> bool:
111111
# Godot Engine compares Array recursively
112112
# There's no need for custom comparison here.
113-
return _uuid == other._uuid
113+
return _uuid == other._uuid

0 commit comments

Comments
 (0)