github.com/urso/go-structform@v0.0.2/cborl/defs.go (about) 1 package cborl 2 3 import "github.com/urso/go-structform/internal/unsafe" 4 5 const ( 6 majorUint uint8 = 0x00 7 majorNeg uint8 = 1 << 5 8 majorBytes uint8 = 2 << 5 9 majorText uint8 = 3 << 5 10 majorArr uint8 = 4 << 5 11 majorMap uint8 = 5 << 5 12 majorTag uint8 = 6 << 5 13 majorOther uint8 = 7 << 5 14 15 majorMask uint8 = 7 << 5 16 minorMask uint8 = ^majorMask 17 ) 18 19 const ( 20 lenSmall uint8 = 0 21 len8b uint8 = 24 22 len16b uint8 = 25 23 len32b uint8 = 26 24 len64b uint8 = 27 25 lenIndef uint8 = 31 26 ) 27 28 const ( 29 codeFalse uint8 = 20 | majorOther 30 codeTrue uint8 = 21 | majorOther 31 codeNull uint8 = 22 | majorOther 32 codeUndef uint8 = 23 | majorOther 33 34 codeHalfFloat uint8 = 25 | majorOther 35 codeSingleFloat uint8 = 26 | majorOther 36 codeDoubleFloat uint8 = 27 | majorOther 37 codeBreak uint8 = lenIndef | majorOther 38 ) 39 40 func str2Bytes(s string) []byte { 41 return unsafe.Str2Bytes(s) 42 } 43 44 func bytes2Str(b []byte) string { 45 return unsafe.Bytes2Str(b) 46 }