Skip to content

Commit

Permalink
Code clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
nurked committed Jul 14, 2021
1 parent 4e8ba85 commit eb5a8ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ func (u UUIDv7) Var() uint16 {
return tmp
}

// Subseq
// Subseq returns The remaining 62 bits which MAY be allocated to any combination of
// additional sub-section precision, sequence counter, or pseudo-
// random data.
func (u UUIDv7) Subseq() uint64 {
bytes := [16]byte(u)
var tmp = toUint64(bytes[8:16])
tmp = tmp & 0b0011_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111
return tmp
}

//SubsecA returns 12-bits allocated to sub-section precision values
func (u UUIDv7) SubsecA() uint16 {
bytes := [16]byte(u)
var tmp uint16 = binary.BigEndian.Uint16(bytes[4:6])
Expand Down

0 comments on commit eb5a8ac

Please sign in to comment.