1package css
 2
 3// generated by hasher -type=Hash -file=hash.go; DO NOT EDIT, except for adding more constants to the list and rerun go generate
 4
 5// uses github.com/tdewolff/hasher
 6//go:generate hasher -type=Hash -file=hash.go
 7
 8// Hash defines perfect hashes for a predefined list of strings
 9type Hash uint32
10
11// Unique hash definitions to be used instead of strings
12const (
13	Document  Hash = 0x8    // document
14	Font_Face Hash = 0x809  // font-face
15	Keyframes Hash = 0x1109 // keyframes
16	Media     Hash = 0x2105 // media
17	Page      Hash = 0x2604 // page
18	Supports  Hash = 0x1908 // supports
19)
20
21// String returns the hash' name.
22func (i Hash) String() string {
23	start := uint32(i >> 8)
24	n := uint32(i & 0xff)
25	if start+n > uint32(len(_Hash_text)) {
26		return ""
27	}
28	return _Hash_text[start : start+n]
29}
30
31// ToHash returns the hash whose name is s. It returns zero if there is no
32// such hash. It is case sensitive.
33func ToHash(s []byte) Hash {
34	if len(s) == 0 || len(s) > _Hash_maxLen {
35		return 0
36	}
37	h := uint32(_Hash_hash0)
38	for i := 0; i < len(s); i++ {
39		h ^= uint32(s[i])
40		h *= 16777619
41	}
42	if i := _Hash_table[h&uint32(len(_Hash_table)-1)]; int(i&0xff) == len(s) {
43		t := _Hash_text[i>>8 : i>>8+i&0xff]
44		for i := 0; i < len(s); i++ {
45			if t[i] != s[i] {
46				goto NEXT
47			}
48		}
49		return i
50	}
51NEXT:
52	if i := _Hash_table[(h>>16)&uint32(len(_Hash_table)-1)]; int(i&0xff) == len(s) {
53		t := _Hash_text[i>>8 : i>>8+i&0xff]
54		for i := 0; i < len(s); i++ {
55			if t[i] != s[i] {
56				return 0
57			}
58		}
59		return i
60	}
61	return 0
62}
63
64const _Hash_hash0 = 0x9acb0442
65const _Hash_maxLen = 9
66const _Hash_text = "documentfont-facekeyframesupportsmediapage"
67
68var _Hash_table = [1 << 3]Hash{
69	0x1: 0x2604, // page
70	0x2: 0x2105, // media
71	0x3: 0x809,  // font-face
72	0x5: 0x1109, // keyframes
73	0x6: 0x1908, // supports
74	0x7: 0x8,    // document
75}