The Tiny HTM Library
Data Structures | Defines | Enumerations | Functions
include/tinyhtm/common.h File Reference

Common macros/functions. More...

#include <stddef.h>
#include <stdint.h>
#include <math.h>
#include "config.h"
+ Include dependency graph for common.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  htm_range
 Represents a range of integers. More...

Defines

#define HTM_UNUSED   __attribute__ ((unused))
 Marks a function argument as unused.
#define HTM_INLINE   static HTM_UNUSED
 Marks a function as inline.
#define HTM_ALIGNED(x)   __attribute__ ((aligned(x)))
 Marks a structure as requiring alignment to x bytes.
#define HTM_ISNAN(x)   ((x) != (x))
 Returns 1 if x is a floating point NaN, 0 otherwise.
#define HTM_ISSPECIAL(x)   ((x) != (x) || ((x) != 0.0 && (x) == 2*(x)))
 Returns 1 if x is NaN or +/- Inf, 0 otherwise.
#define HTM_DEG_PER_RAD   57.2957795130823208767981548141
 Degrees per radian.
#define HTM_RAD_PER_DEG   0.0174532925199432957692369076849
 Radians per degree.
#define HTM_ARCSEC_PER_DEG   3600.0
 Arcseconds per degree.

Enumerations

enum  htm_errcode {
  HTM_OK = 0, HTM_ENOMEM, HTM_ENULLPTR, HTM_ENANINF,
  HTM_EZERONORM, HTM_ELAT, HTM_EANG, HTM_EHEMIS,
  HTM_ELEN, HTM_EDEGEN, HTM_EID, HTM_ELEVEL,
  HTM_EIO, HTM_EMMAN, HTM_EINV, HTM_ETREE,
  HTM_NUM_CODES
}
 Library error codes. More...

Functions

HTM_INLINE int htm_popcount (uint64_t x)
 Counts the number of 1 bits in a 64 bit integer.
const char * htm_errmsg (enum htm_errcode err)
 Returns an error message for the given error code.
HTM_INLINE double htm_angred (double angle_deg)
 Returns the given angle, range-reduced to lie in [0, 360) degrees.
HTM_INLINE double htm_clamp (double x, double min, double max)
 Returns the value of x clamped to [min, max].

Detailed Description

Common macros/functions.

Authors:
Serge Monkewitz

Definition in file common.h.