Header file that contains all common definitions. More...
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
Go to the source code of this file.
Macros | |
#define | __BASE_FILE__ __FILE__ |
#define | FALSE (0) |
#define | NULL (0) |
#define | SBG_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
#define | SBG_COMMON_LIB_API |
#define | SBG_CONST_CAST_AA(x) x |
#define | SBG_CONST_CAST_PP(x) x |
#define | SBG_CONTAINER_OF(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member))) |
#define | SBG_DELETE if (p){free(p); (p) = NULL;} |
#define | SBG_DELETE_ARRAY if (p){free(p); (p) = NULL;} |
#define | SBG_DEPRECATED(func) func |
#define | SBG_DEPRECATED_MACRO(func) func |
#define | SBG_DISABLE (0) |
#define | SBG_ENABLE (1) |
#define | SBG_FALLTHROUGH |
#define | SBG_FREE(p) if (p){free(p); (p) = NULL;} |
#define | SBG_FREE_ARRAY(p) if (p){free(p); (p) = NULL;} |
#define | SBG_INLINE static inline |
#define | SBG_INVALID_HANDLE (0x00000000u) |
#define | SBG_LIKELY(expr) (expr) |
#define | SBG_NOT_FOUND (0xFFFFFFFFu) |
#define | SBG_PI 3.14159265358979323846 |
#define | SBG_PI_F 3.14159265358979323846f |
#define | SBG_STRLEN(s) (sizeof(s) - 1) |
#define | SBG_UNDEFINED (0xFFFFFFFFu) |
#define | SBG_UNLIKELY(expr) (expr) |
#define | SBG_UNUSED_PARAMETER(x) (void)(x) |
#define | sbgAbs(x) (((x) < 0) ? -(x) : (x)) |
#define | sbgClamp(value, minValue, maxValue) (((value) < (minValue))?(minValue): ((value) > (maxValue)?maxValue:value)) |
#define | sbgDivCeil(n, d) (((n) + (d) - 1) / (d)) |
#define | sbgMax(a, b) (((a) > (b)) ? (a) : (b)) |
#define | sbgMin(a, b) (((a) < (b)) ? (a) : (b)) |
#define | TRUE (1) |
Functions | |
SBG_INLINE double | sbgDegToRadD (double angle) |
SBG_INLINE float | sbgDegToRadF (float angle) |
SBG_INLINE double | sbgRadToDegD (double angle) |
SBG_INLINE float | sbgRadToDegF (float angle) |
Header file that contains all common definitions.
Copyright (C) 2007-2015, SBG Systems SAS. All rights reserved.
This source code is intended for use only by SBG Systems SAS and those that have explicit written permission to use it from SBG Systems SAS.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Definition in file sbgDefines.h.
#define __BASE_FILE__ __FILE__ |
BASE_FILE is gcc specific
Definition at line 159 of file sbgDefines.h.
#define FALSE (0) |
Definition at line 73 of file sbgDefines.h.
#define NULL (0) |
Definition at line 81 of file sbgDefines.h.
#define SBG_ARRAY_SIZE | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
Definition at line 97 of file sbgDefines.h.
#define SBG_COMMON_LIB_API |
Macro used to handle export and import methods of the sbgCommon library
Definition at line 58 of file sbgDefines.h.
#define SBG_CONST_CAST_AA | ( | x | ) | x |
XXX Visual C (not C++) doesn't provide anything to implement typeof(). As a result, This macro is private and shouldn't be relied on.
Definition at line 142 of file sbgDefines.h.
#define SBG_CONST_CAST_PP | ( | x | ) | x |
Definition at line 150 of file sbgDefines.h.
#define SBG_CONTAINER_OF | ( | ptr, | |
type, | |||
member | |||
) | ((type *)((char *)(ptr) - offsetof(type, member))) |
Definition at line 105 of file sbgDefines.h.
#define SBG_DELETE if (p){free(p); (p) = NULL;} |
Definition at line 169 of file sbgDefines.h.
#define SBG_DELETE_ARRAY if (p){free(p); (p) = NULL;} |
Definition at line 170 of file sbgDefines.h.
#define SBG_DEPRECATED | ( | func | ) | func |
This macro is used to define a new section of packed structures. All structures defined after this macro will be packed.
This macro is used to specify that a structure is packed.
This macro is used to close the section of packed structures and return to the default packing.
Macro used to indicate that a function is deprecated.
Definition at line 270 of file sbgDefines.h.
#define SBG_DEPRECATED_MACRO | ( | func | ) | func |
Macro used to indicate that a macro is deprecated.
Definition at line 282 of file sbgDefines.h.
#define SBG_DISABLE (0) |
Definition at line 65 of file sbgDefines.h.
#define SBG_ENABLE (1) |
Definition at line 69 of file sbgDefines.h.
#define SBG_FALLTHROUGH |
The fallthrough attribute is used to avoid compiler warning in swith case statements when an intentional break is missing
Definition at line 207 of file sbgDefines.h.
#define SBG_FREE | ( | p | ) | if (p){free(p); (p) = NULL;} |
Definition at line 171 of file sbgDefines.h.
#define SBG_FREE_ARRAY | ( | p | ) | if (p){free(p); (p) = NULL;} |
Definition at line 172 of file sbgDefines.h.
#define SBG_INLINE static inline |
Macro used to abstract the compiler specific inline keyword.
Definition at line 186 of file sbgDefines.h.
#define SBG_INVALID_HANDLE (0x00000000u) |
Definition at line 85 of file sbgDefines.h.
#define SBG_LIKELY | ( | expr | ) | (expr) |
Definition at line 112 of file sbgDefines.h.
#define SBG_NOT_FOUND (0xFFFFFFFFu) |
Definition at line 89 of file sbgDefines.h.
#define SBG_PI 3.14159265358979323846 |
Definition at line 289 of file sbgDefines.h.
#define SBG_PI_F 3.14159265358979323846f |
Definition at line 293 of file sbgDefines.h.
Definition at line 101 of file sbgDefines.h.
#define SBG_UNDEFINED (0xFFFFFFFFu) |
Definition at line 93 of file sbgDefines.h.
#define SBG_UNLIKELY | ( | expr | ) | (expr) |
Definition at line 120 of file sbgDefines.h.
#define SBG_UNUSED_PARAMETER | ( | x | ) | (void)(x) |
Macro used to avoid compiler warning when a variable is not used.
Definition at line 194 of file sbgDefines.h.
#define sbgAbs | ( | x | ) | (((x) < 0) ? -(x) : (x)) |
Returns the absolute value of x.
[in] | x | Signed integer value. |
Definition at line 303 of file sbgDefines.h.
#define sbgClamp | ( | value, | |
minValue, | |||
maxValue | |||
) | (((value) < (minValue))?(minValue): ((value) > (maxValue)?maxValue:value)) |
Clamp a value between minValue and maxValue ie minValue <= value <= maxValue
[in] | value | First operand. |
[in] | minValue | First operand. |
[in] | maxValue | Second operand. |
Definition at line 334 of file sbgDefines.h.
Integer division with a result rounded up.
[in] | n | Dividend. |
[in] | d | Divisor. |
Definition at line 343 of file sbgDefines.h.
#define sbgMax | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Returns the maximum between a and b
[in] | a | First operand. |
[in] | b | Second operand. |
Definition at line 313 of file sbgDefines.h.
#define sbgMin | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Returns the minimum between a and b
[in] | a | First operand. |
[in] | b | Second operand. |
Definition at line 323 of file sbgDefines.h.
#define TRUE (1) |
Definition at line 77 of file sbgDefines.h.
SBG_INLINE double sbgDegToRadD | ( | double | angle | ) |
Convert an angle from degrees to radians using double precision.
[in] | angle | The angle to convert in degrees. |
Definition at line 361 of file sbgDefines.h.
SBG_INLINE float sbgDegToRadF | ( | float | angle | ) |
Convert an angle from degrees to radians using single (float) precision.
[in] | angle | The angle to convert in degrees. |
Definition at line 381 of file sbgDefines.h.
SBG_INLINE double sbgRadToDegD | ( | double | angle | ) |
Convert an angle from radians to degrees using double precision.
[in] | angle | The angle to convert in radians. |
Definition at line 351 of file sbgDefines.h.
SBG_INLINE float sbgRadToDegF | ( | float | angle | ) |
Convert an angle from radians to degrees using single (float) precision.
[in] | angle | The angle to convert in radians. |
Definition at line 371 of file sbgDefines.h.