OpenVDB  9.0.1
common.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 #pragma once
5 
6 #include <cmath>
7 #include <chrono>
8 #include <fstream>
9 #include <nanovdb/NanoVDB.h>
10 #include "ComputePrimitives.h"
11 
12 // http://www.burtleburtle.net/bob/hash/doobs.html
13 inline __hostdev__ uint32_t hash(uint32_t x)
14 {
15  x += (x << 10u);
16  x ^= (x >> 6u);
17  x += (x << 3u);
18  x ^= (x >> 11u);
19  x += (x << 15u);
20  return x;
21 }
22 
23 inline __hostdev__ float randomf(uint32_t s)
24 {
25  return hash(s) / float(0xffffffffu);
26 }
Implements a light-weight self-contained VDB data-structure in a single file! In other words...
A collection of parallel compute primitives.
__hostdev__ uint32_t hash(uint32_t x)
Definition: common.h:13
__hostdev__ float randomf(uint32_t s)
Definition: common.h:23
#define __hostdev__
Definition: NanoVDB.h:168