| 172 | } |
| 173 | |
| 174 | func (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 | |
| 193 | func (c *C) hashValue(s *S, t semantic.Type, value *codegen.Value) *codegen.Value { |
| 194 | keyType := c.T.Target(t) |