rcolyer.net
RC Lib  Version 201607061602
Classes | Namespaces | Macros | Typedefs | Functions
Types.h File Reference

Provides typedefs and routines for working with primitives. More...

#include "RCconfig.h"
#include "Macros.h"
#include <stdint.h>
#include <stddef.h>
#include <limits>
#include <cfloat>
#include <type_traits>

Go to the source code of this file.

Classes

class  RC::Endian
 Auto-detects the endianness of the compilation target, and provides automatic endian conversion features. More...
 

Namespaces

 RC
 

Macros

#define RC_HAVE_F80
 Defined if the 80-bit float was found available on this system.
 
#define RC_THREAD_LOCAL   thread_local
 Provides thread_local if available.
 
#define RC_NOEXCEPT   noexcept
 Provides noexcept if available.
 
#define RC_TYPE_TRUE_MACRO(StructName, Type)
 For adding a new float or integral type, where StructName is FloatType or IntegerType. More...
 

Typedefs

typedef int8_t i8
 8-bit signed integer.
 
typedef uint8_t u8
 8-bit unsigned integer.
 
typedef int16_t i16
 16-bit signed integer.
 
typedef uint16_t u16
 16-bit unsigned integer.
 
typedef int32_t i32
 32-bit signed integer.
 
typedef uint32_t u32
 32-bit unsigned integer.
 
typedef int64_t i64
 64-bit signed integer.
 
typedef uint64_t u64
 64-bit unsigned integer.
 
typedef float f32
 32-bit float.
 
typedef double f64
 64-bit float.
 
typedef long double f80
 80-bit float. (Note: Usually takes 16 bytes.)
 
typedef f128 fBIGGEST
 The biggest float type available.
 
template<class FT >
using RC::FuncPtr = FT *
 Clean C-style function pointers: FuncPtr<void(int)> f = &func; f(4);.
 
template<class C , class FT >
using RC::MemFuncPtr = FT(C::*)
 Clean function pointer syntax for member function. More...
 

Functions

template<class T >
bool RC::IsSignedType (const T &x __attribute__((unused))=0)
 True if the type is signed. More...
 
template<class T >
bool RC::IsIntegerType (const T &x __attribute__((unused))=1)
 True if the type is an integer type. More...
 
template<class T >
void RC::AssertFloat ()
 For generating compilation errors if the type is not a float.
 
template<class T >
void RC::AssertInteger ()
 For generating compilation errors if the type is not an integer.
 
template<class T >
auto RC::ForceFloat (T val) -> typename ForceFloatHelper< T, FloatType< T >::value >::type
 If T is a float type, return the same type. Otherwise return it as an f64.
 
template<class T >
std::make_unsigned< T >::type RC::ForceUnsigned (T val)
 Returns the unsigned equivalent to the given type.
 
template<class T >
std::make_signed< T >::type RC::ForceSigned (T val)
 Returns the signed equivalent to the given type.
 
template<class T >
RC::MIN_VAL (const T &x __attribute__((unused))=std::numeric_limits< T >::min())
 Provide the minimum value held by this type. For floats, the smallest positive value. More...
 
template<class T >
RC::MAX_VAL (const T &x __attribute__((unused))=std::numeric_limits< T >::max())
 Provide the maximum value held by this type. More...
 
template<class T >
RC::LOW_VAL (const T &x __attribute__((unused))=std::numeric_limits< T >::lowest())
 Provide the lowest value held by this type, for which no value is less. More...
 
template<class T >
RC::MIN_POS (const T &x __attribute__((unused))=MIN_POS_Helper< T, FloatType< T >::value >::F())
 Provide the minimum positive value held by this type. More...
 

Detailed Description

Provides typedefs and routines for working with primitives.

Macro Definition Documentation

#define RC_TYPE_TRUE_MACRO (   StructName,
  Type 
)
Value:
template<> struct StructName<Type> { static const bool value = true; };\
template<> struct StructName<const Type> { static const bool value = true; };\
template<> struct StructName<volatile Type> { static const bool value = true; };\
template<> struct StructName<const volatile Type> { static const bool value = true; };

For adding a new float or integral type, where StructName is FloatType or IntegerType.

email address
— (c) 2015