This commit is contained in:
Maxim Bublis 2013-06-18 17:24:02 +04:00
parent 739c217e7b
commit 640f5aa3fa
1 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ var (
NamespaceX500 = UUID{0x6b, 0xa7, 0xb8, 0x14, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
)
// Returns algorithm version used to generate UUID
// Returns algorithm version used to generate UUID.
// RFC 4122 describes version 1, 3, 4 and 5.
func (u *UUID) Version() uint {
return uint(u[6] >> 4)
@ -57,12 +57,12 @@ func (u *UUID) String() string {
u[:4], u[4:6], u[6:8], u[8:10], u[10:])
}
// Set version bits.
// Sets version bits.
func (u *UUID) setVersion(v byte) {
u[6] = (u[6] & 0x0f) | (v << 4)
}
// Set variant bits as described in RFC 4122.
// Sets variant bits as described in RFC 4122.
func (u *UUID) setVariant() {
u[8] = (u[8] & 0xbf) | 0x80
}
@ -78,7 +78,7 @@ func NewV3(ns UUID, name string) (u *UUID, err error) {
return
}
// Returns random UUID.
// Returns random generated UUID.
func NewV4() (u *UUID, err error) {
u = new(UUID)
_, err = rand.Read(u[:])