aboutsummaryrefslogtreecommitdiff
path: root/uuid.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-05-09 13:34:33 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-05-09 13:35:04 -0700
commit1a755ddee807fe4e1b683f32b21d710dc78600a2 (patch)
tree004709fed6704e50b099430945a9adc66ce16e01 /uuid.lua
parent126f51f955351a4ce85f3f1e6da6e9219ec7e23a (diff)
Added tentative support for luajit (depends on pure-lua LPEG
implementation).
Diffstat (limited to 'uuid.lua')
-rw-r--r--uuid.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/uuid.lua b/uuid.lua
index 878727b..563b950 100644
--- a/uuid.lua
+++ b/uuid.lua
@@ -13,10 +13,10 @@ local function uuid()
-- Set the four most significant bits (bits 12 through 15) of the
-- time_hi_and_version field to the 4-bit version number from
-- Section 4.1.3.
- bytes[3] = bit32.bor(bytes[3], 0x4000)
+ bytes[3] = bytes[3] + 0x4000
-- Set the two most significant bits (bits 6 and 7) of the
-- clock_seq_hi_and_reserved to zero and one, respectively.
- bytes[4] = bit32.bor(bytes[4], 0xC0)
+ bytes[4] = bytes[4] + 0xC0
return ("%08x-%04x-%04x-%02x%02x-%6x%6x"):format(unpack(bytes))
end