MHEG5  18.9.0
MHEG5 Documentation
Classes | Macros | Functions
glue_ulong.h File Reference
#include <limits.h>
#include "techtype.h"

Go to the source code of this file.

Classes

struct  U64BIT
 

Macros

#define MAX_64BIT_DECIMAL_STRING   22
 
#define ULL_Get32(variable)   variable.l
 
#define ULL_Add(variable, value)   variable = ULONG_Add(variable, value)
 
#define ULL_Add32(variable, value)   variable = ULONG_Add32(variable, value)
 
#define ULL_Sub(variable, value)   variable = ULONG_Sub(variable, value)
 
#define ULL_Sub32(variable, value)   variable = ULONG_Sub32(variable, value)
 
#define ULL_Mul32(variable, value)   variable = ULONG_Mul32(variable, value)
 
#define ULL_Div32(variable, value)   variable = ULONG_Div32(variable, value)
 
#define ULL_ShiftLeft(variable, value)   variable = ULONG_ShiftLeft(variable, value)
 
#define ULL_ShiftRight(variable, value)   variable = ULONG_ShiftRight(variable, value)
 
#define ULL_Set32(variable, value)   variable.h = 0; variable.l = value;
 
#define ULL_SetInvalid(variable)   variable.h = 0xffffffffU; variable.l = 0xffffffffU;
 
#define ULL_IsValid(variable)   ((variable.h != 0xffffffffU) || (variable.l != 0xffffffffU))
 
#define ULL_IsEqual(variable, value)   (variable.l == value.l && variable.h == value.h)
 
#define ULL_Mod32(variable, value)   ULONG_Mod32(variable, value)
 
#define ULL_Compare(first, second)   ULONG_Compare(first, second)
 
#define ULL_Compare32(first, second)   ULONG_Compare32(first, second)
 
#define ULL_Itoa(variable, str)   ULONG_Itoa(variable, str)
 

Functions

U64BIT ULONG_Add (U64BIT variable, U64BIT value)
 Add a value to a unsigned 64 bit variable. More...
 
U64BIT ULONG_Add32 (U64BIT variable, U32BIT value)
 Add a 32-bit value to a unsigned 64 bit variable. More...
 
U64BIT ULONG_Sub (U64BIT variable, U64BIT value)
 Subtract a value from a unsigned 64 bit variable. It is the responsibility of the caller to make sure the value does not overflow. More...
 
U64BIT ULONG_Sub32 (U64BIT variable, U32BIT value)
 Subtract a 32-bit value from a unsigned 64 bit variable. It is the responsibility of the caller to make sure the value does not overflow. More...
 
U64BIT ULONG_Mul32 (U64BIT variable, U32BIT value)
 Multiply a unsigned 64 bit variable by a 32-bit value. More...
 
U64BIT ULONG_Div32 (U64BIT variable, U32BIT value)
 Divide a unsigned 64 bit variable by a 24-bit value. NOTE: This function will produce invalid values if the divisor requires more than 24 bits (larger than 16777215). More...
 
U64BIT ULONG_ShiftLeft (U64BIT variable, U32BIT value)
 Shift bits left on unsigned 64 bit variable by a 32-bit value. More...
 
U64BIT ULONG_ShiftRight (U64BIT variable, U32BIT value)
 Shift bits right on unsigned 64 bit variable by a 32-bit value. More...
 
U32BIT ULONG_Mod32 (U64BIT variable, U32BIT value)
 Find the remainer after dividing a unsigned 64 bit variable by a 24-bit value. NOTE: This function will produce invalid values if the divisor requires more than 24 bits (larger than 16777215). More...
 
S32BIT ULONG_Compare (U64BIT first, U64BIT second)
 Compare two variables, returning a value that indicates the result of the comparison. More...
 
S32BIT ULONG_Compare32 (U64BIT variable, U32BIT value)
 Compare a variable with a 32-bit value, returning a value that indicates the result of the comparison. More...
 
U64BIT ULONG_Atoi (char *str)
 Convert a string to unsigned 64 bit. Only the numeric part of the string is converted (up to the first non-digit character). The string value should be less than 2**64-1. More...
 
void ULONG_Itoa (U64BIT variable, char *str)
 Convert unsigned 64 bit to a string. The string should be able to hold at least 21 characters, as the largest unsigned 64 bit is 18446744073709551615 (2**64-1). More...
 

Detailed Description

Date
20/12/2012
Author
Adam Sturtridge

Definition in file glue_ulong.h.

Macro Definition Documentation

#define MAX_64BIT_DECIMAL_STRING   22

Definition at line 57 of file glue_ulong.h.

#define ULL_Add (   variable,
  value 
)    variable = ULONG_Add(variable, value)

Definition at line 80 of file glue_ulong.h.

#define ULL_Add32 (   variable,
  value 
)    variable = ULONG_Add32(variable, value)

Definition at line 81 of file glue_ulong.h.

#define ULL_Compare (   first,
  second 
)    ULONG_Compare(first, second)

Definition at line 93 of file glue_ulong.h.

#define ULL_Compare32 (   first,
  second 
)    ULONG_Compare32(first, second)

Definition at line 94 of file glue_ulong.h.

#define ULL_Div32 (   variable,
  value 
)    variable = ULONG_Div32(variable, value)

Definition at line 85 of file glue_ulong.h.

#define ULL_Get32 (   variable)    variable.l

Definition at line 79 of file glue_ulong.h.

#define ULL_IsEqual (   variable,
  value 
)    (variable.l == value.l && variable.h == value.h)

Definition at line 91 of file glue_ulong.h.

#define ULL_IsValid (   variable)    ((variable.h != 0xffffffffU) || (variable.l != 0xffffffffU))

Definition at line 90 of file glue_ulong.h.

#define ULL_Itoa (   variable,
  str 
)    ULONG_Itoa(variable, str)

Definition at line 97 of file glue_ulong.h.

#define ULL_Mod32 (   variable,
  value 
)    ULONG_Mod32(variable, value)

Definition at line 92 of file glue_ulong.h.

#define ULL_Mul32 (   variable,
  value 
)    variable = ULONG_Mul32(variable, value)

Definition at line 84 of file glue_ulong.h.

#define ULL_Set32 (   variable,
  value 
)    variable.h = 0; variable.l = value;

Definition at line 88 of file glue_ulong.h.

#define ULL_SetInvalid (   variable)    variable.h = 0xffffffffU; variable.l = 0xffffffffU;

Definition at line 89 of file glue_ulong.h.

#define ULL_ShiftLeft (   variable,
  value 
)    variable = ULONG_ShiftLeft(variable, value)

Definition at line 86 of file glue_ulong.h.

#define ULL_ShiftRight (   variable,
  value 
)    variable = ULONG_ShiftRight(variable, value)

Definition at line 87 of file glue_ulong.h.

#define ULL_Sub (   variable,
  value 
)    variable = ULONG_Sub(variable, value)

Definition at line 82 of file glue_ulong.h.

#define ULL_Sub32 (   variable,
  value 
)    variable = ULONG_Sub32(variable, value)

Definition at line 83 of file glue_ulong.h.

Function Documentation

U64BIT ULONG_Add ( U64BIT  variable,
U64BIT  value 
)

Add a value to a unsigned 64 bit variable.

Parameters
variableUnsigned 64 bit
valueValue to add
Returns
Nothing
Parameters
variableUnsigned 64 bit
valueValue to add
Returns
resulting value

Definition at line 48 of file glue_ulong.c.

U64BIT ULONG_Add32 ( U64BIT  variable,
U32BIT  value 
)

Add a 32-bit value to a unsigned 64 bit variable.

Parameters
variableUnsigned 64 bit
valueValue to add (32 bit)
Returns
Nothing
Parameters
variableUnsigned 64 bit
valueValue to add (32 bit)
Returns
resulting value

Definition at line 68 of file glue_ulong.c.

U64BIT ULONG_Atoi ( char *  str)

Convert a string to unsigned 64 bit. Only the numeric part of the string is converted (up to the first non-digit character). The string value should be less than 2**64-1.

USE_TRUE_64BIT

Parameters
strString value
Returns
Unsigned 64 bit

Convert a string to unsigned 64 bit. Only the numeric part of the string is converted (up to the first non-digit character). The string value should be less than 2**64-1.

Parameters
strString value
Returns
Unsigned 64 bit

Definition at line 398 of file glue_ulong.c.

S32BIT ULONG_Compare ( U64BIT  first,
U64BIT  second 
)

Compare two variables, returning a value that indicates the result of the comparison.

Parameters
firstFirst unsigned 64 bit to compare
secondSecond unsigned 64 bit to compare
Returns
0 if the variables are equal, negative if the first variable is smaller than the second variable, and positive if the first variable is larger than the second variable
Parameters
firstFirst unsigned 64 bit to compare
secondSecond unsigned 64 bit to compare
Returns
0 if the variables are equal, negative if the first variable is smaller than the second variable, and positive if the first variable is larger than the secodd variable

Definition at line 321 of file glue_ulong.c.

S32BIT ULONG_Compare32 ( U64BIT  variable,
U32BIT  value 
)

Compare a variable with a 32-bit value, returning a value that indicates the result of the comparison.

Parameters
variableUnsigned 64 bit to compare
value32-bit value to compare to
Returns
0 if the variables are equal, negative if the first variable is smaller than the second variable, and positive if the first variable is larger than the second variable

Definition at line 364 of file glue_ulong.c.

U64BIT ULONG_Div32 ( U64BIT  variable,
U32BIT  value 
)

Divide a unsigned 64 bit variable by a 24-bit value. NOTE: This function will produce invalid values if the divisor requires more than 24 bits (larger than 16777215).

Parameters
variableUnsigned 64 bit
valueValue to divide by (24 bit)
Returns
Nothing

Definition at line 195 of file glue_ulong.c.

void ULONG_Itoa ( U64BIT  variable,
char *  str 
)

Convert unsigned 64 bit to a string. The string should be able to hold at least 21 characters, as the largest unsigned 64 bit is 18446744073709551615 (2**64-1).

Parameters
variableUnsigned 64 bit
strBuffer for string value (at least 22 bytes)
Returns
Nothing

Convert unsigned 64 bit to a string. The string should be able to hold at least 21 characters, as the largest unsigned 64 bit is 18446744073709551615 (2**64-1).

Parameters
variableUnsigned 64 bit
strBuffer for string value (at least 22 bytes)
Returns
Nothing

Definition at line 427 of file glue_ulong.c.

U32BIT ULONG_Mod32 ( U64BIT  variable,
U32BIT  value 
)

Find the remainer after dividing a unsigned 64 bit variable by a 24-bit value. NOTE: This function will produce invalid values if the divisor requires more than 24 bits (larger than 16777215).

Parameters
variableUnsigned 64 bit
valueValue to divide by (24 bit)
Returns
The variable modulo the value

Definition at line 299 of file glue_ulong.c.

U64BIT ULONG_Mul32 ( U64BIT  variable,
U32BIT  value 
)

Multiply a unsigned 64 bit variable by a 32-bit value.

Parameters
variableUnsigned 64 bit
valueValue to multiply by (32 bit)
Returns
Nothing

Definition at line 124 of file glue_ulong.c.

U64BIT ULONG_ShiftLeft ( U64BIT  variable,
U32BIT  value 
)

Shift bits left on unsigned 64 bit variable by a 32-bit value.

Parameters
variableUnsigned 64 bit
valueValue to shift by (32 bit)
Returns
Nothing

Definition at line 236 of file glue_ulong.c.

U64BIT ULONG_ShiftRight ( U64BIT  variable,
U32BIT  value 
)

Shift bits right on unsigned 64 bit variable by a 32-bit value.

Parameters
variableUnsigned 64 bit
valueValue to shift by (32 bit)
Returns
Nothing

Definition at line 266 of file glue_ulong.c.

U64BIT ULONG_Sub ( U64BIT  variable,
U64BIT  value 
)

Subtract a value from a unsigned 64 bit variable. It is the responsibility of the caller to make sure the value does not overflow.

Parameters
variableUnsigned 64 bit
valueValue to subtract
Returns
Nothing

Definition at line 89 of file glue_ulong.c.

U64BIT ULONG_Sub32 ( U64BIT  variable,
U32BIT  value 
)

Subtract a 32-bit value from a unsigned 64 bit variable. It is the responsibility of the caller to make sure the value does not overflow.

Parameters
variableUnsigned 64 bit
valueValue to subtract (32 bit)
Returns
Nothing

Definition at line 108 of file glue_ulong.c.