MCPcopy Create free account
hub / github.com/google/gapid / hashVariableValue

Method hashVariableValue

gapil/compiler/map.go:174–191  ·  view source on GitHub ↗
(s *S, pointer *codegen.Value, numBytes *codegen.Value)

Source from the content-addressed store, hash-verified

172}
173
174func (c *C) hashVariableValue(s *S, pointer *codegen.Value, numBytes *codegen.Value) *codegen.Value {
175 u64Type := c.T.Target(semantic.Uint64Type)
176 numBytes = numBytes.Load().Cast(u64Type)
177 v := s.Local("_hash", u64Type)
178 v.Store(s.Scalar(uint64(0)))
179 s.ForN(numBytes, func(s *S, it *codegen.Value) *codegen.Value {
180 tv := v.Load()
181 l6 := s.ShiftLeft(tv, s.Scalar(uint64(6)))
182 l16 := s.ShiftLeft(tv, s.Scalar(uint64(16)))
183 dat := pointer.Index(0, it).Load().Cast(u64Type)
184 r := s.Add(dat, l6)
185 r = s.Add(r, l16)
186 r = s.Add(r, tv)
187 v.Store(r)
188 return nil
189 })
190 return v.Load()
191}
192
193func (c *C) hashValue(s *S, t semantic.Type, value *codegen.Value) *codegen.Value {
194 keyType := c.T.Target(t)

Callers 1

hashValueMethod · 0.95

Calls 10

LocalMethod · 0.80
ShiftLeftMethod · 0.80
LoadMethod · 0.65
StoreMethod · 0.65
IndexMethod · 0.65
AddMethod · 0.65
TargetMethod · 0.45
CastMethod · 0.45
ScalarMethod · 0.45
ForNMethod · 0.45

Tested by

no test coverage detected