Flutter Engine
The Flutter Engine
hash.h
Go to the documentation of this file.
1// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_HASH_H_
6#define RUNTIME_VM_HASH_H_
7
8#include "platform/globals.h"
9
10namespace dart {
11
12inline uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) {
13 // Keep in sync with AssemblerBase::CombineHashes.
14 hash += other_hash;
15 hash += hash << 10;
16 hash ^= hash >> 6; // Logical shift, unsigned hash.
17 return hash;
18}
19
20inline uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits = kBitsPerInt32) {
21 // Keep in sync with AssemblerBase::FinalizeHash.
22 hash += hash << 3;
23 hash ^= hash >> 11; // Logical shift, unsigned hash.
24 hash += hash << 15;
25 if (hashbits < kBitsPerInt32) {
26 hash &= (static_cast<uint32_t>(1) << hashbits) - 1;
27 }
28 return (hash == 0) ? 1 : hash;
29}
30
31inline uint32_t HashBytes(const uint8_t* bytes, intptr_t size) {
32 uint32_t hash = size;
33 while (size > 0) {
34 hash = CombineHashes(hash, *bytes);
35 bytes++;
36 size--;
37 }
38 return hash;
39}
40
41} // namespace dart
42
43#endif // RUNTIME_VM_HASH_H_
static uint32_t hash(const SkShaderBase::GradientInfo &v)
Definition: dart_vm.cc:33
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
Definition: hash.h:12
uint32_t HashBytes(const uint8_t *bytes, intptr_t size)
Definition: hash.h:31
constexpr intptr_t kBitsPerInt32
Definition: globals.h:466
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
Definition: hash.h:20
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259