OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
Util.h File Reference

Utility functions. More...

#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <limits>
#include <utility>

Go to the source code of this file.

Classes

struct  is_same< T0, T1, T >
 C++11 implementation of std::is_same. More...
 
struct  is_same< T0, T1 >
 
struct  is_same< T, T >
 
struct  is_floating_point< T >
 C++11 implementation of std::is_floating_point. More...
 
struct  enable_if< bool, T >
 C++11 implementation of std::enable_if. More...
 
struct  enable_if< true, T >
 
struct  disable_if< bool, T >
 
struct  disable_if< true, T >
 
struct  is_const< T >
 
struct  is_const< const T >
 
struct  is_pointer< T >
 Trait used to identify template parameter that are pointers. More...
 
struct  is_pointer< T * >
 Template specialization of pointers. More...
 
struct  conditional< bool, TrueT, FalseT >
 C++11 implementation of std::conditional. More...
 
struct  conditional< false, TrueT, FalseT >
 Template specialization of conditional. More...
 
struct  remove_const< T >
 Trait use to const from type. Default implementation is just a pass-through. More...
 
struct  remove_const< const T >
 Template specialization of trait class use to remove const qualifier type from a type. More...
 
struct  remove_reference< T >
 Trait use to remove reference, i.e. "&", qualifier from a type. Default implementation is just a pass-through. More...
 
struct  remove_reference< T & >
 Template specialization of trait class use to remove reference, i.e. "&", qualifier from a type. More...
 
struct  remove_pointer< T >
 Trait use to remove pointer, i.e. "*", qualifier from a type. Default implementation is just a pass-through. More...
 
struct  remove_pointer< T * >
 Template specialization of trait class use to to remove pointer, i.e. "*", qualifier from a type. More...
 
struct  match_const< T, ReferenceT >
 Trait used to transfer the const-ness of a reference type to another type. More...
 
struct  match_const< T, const ReferenceT >
 Template specialization used to transfer the const-ness of a reference type to another type. More...
 
struct  is_specialization< AnyType, TemplateType >
 Metafunction used to determine if the first template parameter is a specialization of the class template given in the second template parameter. More...
 
struct  is_specialization< TemplateType< Args... >, TemplateType >
 

Namespaces

namespace  nanovdb
 
namespace  nanovdb::util
 
namespace  nanovdb::util::impl
 

Macros

#define NANOVDB_ASSERT(x)
 
#define __hostdev__
 
#define __global__
 
#define __device__
 
#define __host__
 
#define NANOVDB_HOSTDEV_DISABLE_WARNING
 
#define NANOVDB_OFFSETOF(CLASS, MEMBER)
 Defines macros that issues warnings for deprecated header files.
 

Functions

template<typename T>
T && declval () noexcept
 Minimal implementation of std::declval, which converts any type T to.
 
bool empty (const char *str)
 tests if a c-string str is empty, that is its first value is '\0'
 
size_t strlen (const char *str)
 length of a c-sting, excluding '\0'.
 
char * strcpy (char *dst, const char *src)
 Copy characters from src to dst.
 
char * strncpy (char *dst, const char *src, size_t max)
 Copies the first num characters of src to dst. If the end of the source C string (which is signaled by a null-character) is found before max characters have been copied, dst is padded with zeros until a total of max characters have been written to it.
 
char * strcpy (char *dst, int num, int bas=10)
 converts a number to a string using a specific base
 
char * strcat (char *dst, const char *src)
 Appends a copy of the character string pointed to by src to the end of the character string pointed to by dst on the device.
 
char * strcat (char *dst, int num, int bas=10)
 concatenates a number after a string using a specific base
 
int strcmp (const char *lhs, const char *rhs)
 Compares two null-terminated byte strings lexicographically.
 
bool streq (const char *lhs, const char *rhs)
 Test if two null-terminated byte strings are the same.
 
char * sprint (char *dst)
 
template<typename T, typename... Types>
char * sprint (char *dst, T var1, Types... var2)
 
template<typename T, typename... Types>
char * sprint (char *dst, T var1, Types... var2)
 prints a variable number of string and/or numbers to a destination string
 
static void * memzero (void *dst, size_t byteCount)
 Zero initialization of memory.
 
static int64_t PtrDiff (const void *p, const void *q)
 Compute the distance, in bytes, between two pointers, dist = p - q.
 
template<typename DstT = void>
static DstT * PtrAdd (void *p, int64_t offset)
 Adds a byte offset to a non-const pointer to produce another non-const pointer.
 
template<typename DstT = void>
static const DstT * PtrAdd (const void *p, int64_t offset)
 Adds a byte offset to a const pointer to produce another const pointer.
 
uint32_t findLowestOn (uint32_t v)
 Returns the index of the lowest, i.e. least significant, on bit in the specified 32 bit word.
 
uint32_t findLowestOn (uint64_t v)
 Returns the index of the lowest, i.e. least significant, on bit in the specified 64 bit word.
 
uint32_t findHighestOn (uint32_t v)
 Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word.
 
uint32_t findHighestOn (uint64_t v)
 Returns the index of the highest, i.e. most significant, on bit in the specified 64 bit word.
 
uint32_t countOn (uint64_t v)
 
uint32_t FindLowestOn (uint32_t v)
 
uint32_t FindLowestOn (uint64_t v)
 
uint32_t FindHighestOn (uint32_t v)
 
uint32_t FindHighestOn (uint64_t v)
 
uint32_t CountOn (uint64_t v)
 

Detailed Description

Utility functions.

Author
Ken Museth
Date
January 8, 2020

Macro Definition Documentation

◆ __device__

#define __device__

◆ __global__

#define __global__

◆ __host__

#define __host__

◆ __hostdev__

#define __hostdev__

◆ NANOVDB_ASSERT

#define NANOVDB_ASSERT ( x)
Value:
assert(x)

◆ NANOVDB_HOSTDEV_DISABLE_WARNING

#define NANOVDB_HOSTDEV_DISABLE_WARNING

◆ NANOVDB_OFFSETOF

#define NANOVDB_OFFSETOF ( CLASS,
MEMBER )
Value:
((int)(size_t)((char*)&((CLASS*)0)->MEMBER - (char*)0))

Defines macros that issues warnings for deprecated header files.

Example:

#include <nanovdb/util/Util.h> // for NANOVDB_DEPRECATED_HEADER
#include <nanovdb/path/Alternative.h>
NANOVDB_DEPRECATED_HEADER("This header file is deprecated, please use <nanovdb/path/Alternative.h> instead")
Utility functions.