OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-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
14inline __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
24inline __hostdev__ float randomf(uint32_t s)
25{
26 return hash(s) / float(0xffffffffu);
27}
A collection of parallel compute primitives.
Implements a light-weight self-contained VDB data-structure in a single file! In other words,...
__hostdev__ float randomf(uint32_t s)
Definition common.h:24
__hostdev__ uint32_t hash(uint32_t x)
Definition common.h:14
#define __hostdev__
Definition Util.h:73