OpenVDB  11.0.0
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 #define _USE_MATH_DEFINES
7 #include <cmath>
8 #include <chrono>
9 #include <fstream>
10 #include <nanovdb/NanoVDB.h>
11 #include "ComputePrimitives.h"
12 
13 // http://www.burtleburtle.net/bob/hash/doobs.html
14 inline __hostdev__ uint32_t hash(uint32_t x)
15 {
16  x += (x << 10u);
17  x ^= (x >> 6u);
18  x += (x << 3u);
19  x ^= (x >> 11u);
20  x += (x << 15u);
21  return x;
22 }
23 
24 inline __hostdev__ float randomf(uint32_t s)
25 {
26  return hash(s) / float(0xffffffffu);
27 }
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:14
__hostdev__ float randomf(uint32_t s)
Definition: common.h:24
#define __hostdev__
Definition: NanoVDB.h:213