Linux Assemblycollection of fast libraries

Array libraryArray.h

Array manipulations are core functions of many popular algorithms: linear and binary searching, sorting keys and mathematical operations to vectors. If these operations can be optimized in many times, then all programs that use them can process data much faster. And responsibility of whole system will grow up.

Array library provides very fast and optimized routines to work with integer and floating-point arrays. It uses SIMD extension of modern x86-64 processors to accelerate data manipulations. Cache prefetch and hint instructions speed up memory operations and improve total speed of algorithms, especially for very big arrays. See the benchmarks.

Contents

Function list

C function nameFunctionsC++ function nameFunctions
Abs6 functionsAbs6 functions
AddScalar11 functionsAddScalar11 functions
AddVector11 functionsAddVector11 functions
AndScalar9 functionsAndScalar9 functions
AndVector9 functionsAndVector9 functions
BitReverse9 functionsBitReverse9 functions
ByteSwap9 functionsByteSwap9 functions
CheckDiff12 functionsCheckDiff12 functions
CheckDiffObj1 functionCheckDiffObj1 function
CheckDup11 functionsCheckDup11 functions
CheckDupObj1 functionCheckDupObj1 function
CheckInf2 functionsCheckInf2 functions
CheckNaN2 functionsCheckNaN2 functions
CheckSortAsc11 functionsCheckSortAsc11 functions
CheckSortDsc11 functionsCheckSortDsc11 functions
CheckSortObjAsc1 functionCheckSortObjAsc1 function
CheckSortObjDsc1 functionCheckSortObjDsc1 function
Clone12 functionsClone12 functions
Compare12 functionsCompare12 functions
CompareObj1 functionCompareObj1 function
ConvertToFlt321 functionConvertToFlt321 function
ConvertToFlt322 functionsConvertToFlt322 functions
ConvertToFlt641 functionConvertToFlt641 function
ConvertToFlt642 functionsConvertToFlt642 functions
ConvertToSint322 functionsConvertToSint322 functions
ConvertToSint642 functionsConvertToSint642 functions
Copy12 functionsCopy12 functions
Count9 functionsCount9 functions
CountAsc9 functionsCountAsc9 functions
CountBits10 functionsCountBits10 functions
CountDsc9 functionsCountDsc9 functions
CountObj1 functionCountObj1 function
CountObjAsc1 functionCountObjAsc1 function
CountObjDsc1 functionCountObjDsc1 function
DivScalar2 functionsDivScalar2 functions
DivVector2 functionsDivVector2 functions
Duplicates9 functionsDuplicates9 functions
DuplicatesObj1 functionDuplicatesObj1 function
FindBwd9 functionsFindBwd9 functions
FindFirstEqualAsc9 functionsFindFirstEqualAsc9 functions
FindFirstEqualDsc9 functionsFindFirstEqualDsc9 functions
FindFirstEqualObjAsc1 functionFindFirstEqualObjAsc1 function
FindFirstEqualObjDsc1 functionFindFirstEqualObjDsc1 function
FindFwd9 functionsFindFwd9 functions
FindGreatAsc9 functionsFindGreatAsc9 functions
FindGreatDsc9 functionsFindGreatDsc9 functions
FindGreatObjAsc1 functionFindGreatObjAsc1 function
FindGreatObjDsc1 functionFindGreatObjDsc1 function
FindGreatOrEqualAsc9 functionsFindGreatOrEqualAsc9 functions
FindGreatOrEqualDsc9 functionsFindGreatOrEqualDsc9 functions
FindGreatOrEqualObjAsc1 functionFindGreatOrEqualObjAsc1 function
FindGreatOrEqualObjDsc1 functionFindGreatOrEqualObjDsc1 function
FindLastEqualAsc9 functionsFindLastEqualAsc9 functions
FindLastEqualDsc9 functionsFindLastEqualDsc9 functions
FindLastEqualObjAsc1 functionFindLastEqualObjAsc1 function
FindLastEqualObjDsc1 functionFindLastEqualObjDsc1 function
FindLessAsc9 functionsFindLessAsc9 functions
FindLessDsc9 functionsFindLessDsc9 functions
FindLessObjAsc1 functionFindLessObjAsc1 function
FindLessObjDsc1 functionFindLessObjDsc1 function
FindLessOrEqualAsc9 functionsFindLessOrEqualAsc9 functions
FindLessOrEqualDsc9 functionsFindLessOrEqualDsc9 functions
FindLessOrEqualObjAsc1 functionFindLessOrEqualObjAsc1 function
FindLessOrEqualObjDsc1 functionFindLessOrEqualObjDsc1 function
FindObjBwd1 functionFindObjBwd1 function
FindObjFwd1 functionFindObjFwd1 function
FindResetBitBwd10 functionsFindResetBitBwd10 functions
FindResetBitFwd10 functionsFindResetBitFwd10 functions
FindSetBitBwd10 functionsFindSetBitBwd10 functions
FindSetBitFwd10 functionsFindSetBitFwd10 functions
Frac2 functionsFrac2 functions
GetBit10 functionsGetBit10 functions
Hash3212 functionsHash3212 functions
Hash6412 functionsHash6412 functions
Init11 functionsInit11 functions
InsertSortAsc11 functionsInsertSortAsc11 functions
InsertSortDsc11 functionsInsertSortDsc11 functions
InsertSortKeyAsc11 functionsInsertSortKeyAsc11 functions
InsertSortKeyDsc11 functionsInsertSortKeyDsc11 functions
InsertSortObjAsc1 functionInsertSortObjAsc1 function
InsertSortObjDsc1 functionInsertSortObjDsc1 function
InvertBit10 functionsInvertBit10 functions
Max8 functionsMax8 functions
MaxAbs5 functionsMaxAbs5 functions
MaxObjBwd1 functionMaxObjBwd1 function
MaxObjFwd1 functionMaxObjFwd1 function
MergeAsc11 functionsMergeAsc11 functions
MergeDsc11 functionsMergeDsc11 functions
MergeKeyAsc11 functionsMergeKeyAsc11 functions
MergeKeyDsc11 functionsMergeKeyDsc11 functions
MergeObjAsc1 functionMergeObjAsc1 function
MergeObjDsc1 functionMergeObjDsc1 function
MergeSortAsc11 functionsMergeSortAsc11 functions
MergeSortDsc11 functionsMergeSortDsc11 functions
MergeSortKeyAsc11 functionsMergeSortKeyAsc11 functions
MergeSortKeyDsc11 functionsMergeSortKeyDsc11 functions
MergeSortObjAsc1 functionMergeSortObjAsc1 function
MergeSortObjDsc1 functionMergeSortObjDsc1 function
Min8 functionsMin8 functions
MinAbs5 functionsMinAbs5 functions
MinObjBwd1 functionMinObjBwd1 function
MinObjFwd1 functionMinObjFwd1 function
Move12 functionsMove12 functions
MulScalar2 functionsMulScalar2 functions
MulVector2 functionsMulVector2 functions
Neg6 functionsNeg6 functions
NegAbs6 functionsNegAbs6 functions
Not9 functionsNot9 functions
OrScalar9 functionsOrScalar9 functions
OrVector9 functionsOrVector9 functions
Overlap12 functionsOverlap12 functions
PopCount9 functionsPopCount9 functions
QuickSortAsc11 functionsQuickSortAsc11 functions
QuickSortDsc11 functionsQuickSortDsc11 functions
QuickSortKeyAsc11 functionsQuickSortKeyAsc11 functions
QuickSortKeyDsc11 functionsQuickSortKeyDsc11 functions
QuickSortObjAsc1 functionQuickSortObjAsc1 function
QuickSortObjDsc1 functionQuickSortObjDsc1 function
RadixSortAsc11 functionsRadixSortAsc11 functions
RadixSortDsc11 functionsRadixSortDsc11 functions
RadixSortKeyAsc11 functionsRadixSortKeyAsc11 functions
RadixSortKeyDsc11 functionsRadixSortKeyDsc11 functions
Replace9 functionsReplace9 functions
ReplaceObj1 functionReplaceObj1 function
ResetBit10 functionsResetBit10 functions
Reverse11 functionsReverse11 functions
ReverseDivScalar2 functionsReverseDivScalar2 functions
ReverseDivVector2 functionsReverseDivVector2 functions
ReverseObj1 functionReverseObj1 function
ReverseSubScalar11 functionsReverseSubScalar11 functions
ReverseSubVector11 functionsReverseSubVector11 functions
Round2 functionsRound2 functions
RoundDown2 functionsRoundDown2 functions
RoundInt2 functionsRoundInt2 functions
RoundUp2 functionsRoundUp2 functions
SetBit10 functionsSetBit10 functions
Sign6 functionsSign6 functions
Sqr2 functionsSqr2 functions
Sqrt2 functionsSqrt2 functions
SubScalar11 functionsSubScalar11 functions
SubVector11 functionsSubVector11 functions
Sum2 functionsSum2 functions
SumAbs2 functionsSumAbs2 functions
SumAbsDiff2 functionsSumAbsDiff2 functions
SumMul2 functionsSumMul2 functions
SumSqr2 functionsSumSqr2 functions
SumSqrDiff2 functionsSumSqrDiff2 functions
Truncate2 functionsTruncate2 functions
TruncateToSint322 functionsTruncateToSint322 functions
TruncateToSint642 functionsTruncateToSint642 functions
Unique9 functionsUnique9 functions
UniqueObj1 functionUniqueObj1 function
XorScalar9 functionsXorScalar9 functions
XorVector9 functionsXorVector9 functions
C function nameFunctionsC++ function nameFunctions

Key compare function prototype

Key compare function is used by searching and sorting algorithms. It takes two constant keys and returns relation between them as signed integer number: 0 if first key is equal to second key; 1 if first key is greater than second key, and -1 if first key is less than second key.

Each user defined key compare function should conform to the prototype specified below.

C/C++sint64_t Cmp (const void *key1, const void *key2);

Parameters:

  • key1 - a constant pointer to first key
  • key2 - a constant pointer to second key

Return value:

  • -1 - if first key is less than second key
  • 0 - if first key is equal to second key
  • +1 - if first key is greater than second key

Initialization

C
Unsigned integer types
void Array_Init_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_Init_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_Init_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_Init_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_Init_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_Init_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_Init_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_Init_sint64 (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array_Init_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_Init_flt64 (flt64_t array[], size_t size, flt64_t value);

Other types
void Array_Init_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::Init (uint8_t array[], size_t size, uint8_t value);
void Array::Init (uint16_t array[], size_t size, uint16_t value);
void Array::Init (uint32_t array[], size_t size, uint32_t value);
void Array::Init (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::Init (sint8_t array[], size_t size, sint8_t value);
void Array::Init (sint16_t array[], size_t size, sint16_t value);
void Array::Init (sint32_t array[], size_t size, sint32_t value);
void Array::Init (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array::Init (flt32_t array[], size_t size, flt32_t value);
void Array::Init (flt64_t array[], size_t size, flt64_t value);

Other types
void Array::Init (size_t array[], size_t size, size_t value);

Description: Init all array elements with specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - initialization value for all elements

Return value: None.

Copying arrays

C
Unsigned integer types
void Array_Copy_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_Copy_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_Copy_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_Copy_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_Copy_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_Copy_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_Copy_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_Copy_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array_Copy_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_Copy_flt64 (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array_Copy_size (size_t target[], const size_t source[], size_t size);
void Array_Copy (void *target, const void *source, size_t size);
C++
Unsigned integer types
void Array::Copy (uint8_t target[], const uint8_t source[], size_t size);
void Array::Copy (uint16_t target[], const uint16_t source[], size_t size);
void Array::Copy (uint32_t target[], const uint32_t source[], size_t size);
void Array::Copy (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::Copy (sint8_t target[], const sint8_t source[], size_t size);
void Array::Copy (sint16_t target[], const sint16_t source[], size_t size);
void Array::Copy (sint32_t target[], const sint32_t source[], size_t size);
void Array::Copy (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array::Copy (flt32_t target[], const flt32_t source[], size_t size);
void Array::Copy (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array::Copy (size_t target[], const size_t source[], size_t size);
void Array::Copy (void *target, const void *source, size_t size);

Description: Copy all elements from source array to target array.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Moving arrays

C
Unsigned integer types
void Array_Move_uint8 (uint8_t target[], uint8_t source[], size_t size);
void Array_Move_uint16 (uint16_t target[], uint16_t source[], size_t size);
void Array_Move_uint32 (uint32_t target[], uint32_t source[], size_t size);
void Array_Move_uint64 (uint64_t target[], uint64_t source[], size_t size);

Signed integer types
void Array_Move_sint8 (sint8_t target[], sint8_t source[], size_t size);
void Array_Move_sint16 (sint16_t target[], sint16_t source[], size_t size);
void Array_Move_sint32 (sint32_t target[], sint32_t source[], size_t size);
void Array_Move_sint64 (sint64_t target[], sint64_t source[], size_t size);

Floating-point types
void Array_Move_flt32 (flt32_t target[], flt32_t source[], size_t size);
void Array_Move_flt64 (flt64_t target[], flt64_t source[], size_t size);

Other types
void Array_Move_size (size_t target[], size_t source[], size_t size);
void Array_Move (void *target, void *source, size_t size);
C++
Unsigned integer types
void Array::Move (uint8_t target[], uint8_t source[], size_t size);
void Array::Move (uint16_t target[], uint16_t source[], size_t size);
void Array::Move (uint32_t target[], uint32_t source[], size_t size);
void Array::Move (uint64_t target[], uint64_t source[], size_t size);

Signed integer types
void Array::Move (sint8_t target[], sint8_t source[], size_t size);
void Array::Move (sint16_t target[], sint16_t source[], size_t size);
void Array::Move (sint32_t target[], sint32_t source[], size_t size);
void Array::Move (sint64_t target[], sint64_t source[], size_t size);

Floating-point types
void Array::Move (flt32_t target[], flt32_t source[], size_t size);
void Array::Move (flt64_t target[], flt64_t source[], size_t size);

Other types
void Array::Move (size_t target[], size_t source[], size_t size);
void Array::Move (void *target, void *source, size_t size);

Description: Move elements from source array to target array.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Pattern cloning

C
Unsigned integer types
void Array_Clone_uint8 (uint8_t array[], size_t size, size_t psize);
void Array_Clone_uint16 (uint16_t array[], size_t size, size_t psize);
void Array_Clone_uint32 (uint32_t array[], size_t size, size_t psize);
void Array_Clone_uint64 (uint64_t array[], size_t size, size_t psize);

Signed integer types
void Array_Clone_sint8 (sint8_t array[], size_t size, size_t psize);
void Array_Clone_sint16 (sint16_t array[], size_t size, size_t psize);
void Array_Clone_sint32 (sint32_t array[], size_t size, size_t psize);
void Array_Clone_sint64 (sint64_t array[], size_t size, size_t psize);

Floating-point types
void Array_Clone_flt32 (flt32_t array[], size_t size, size_t psize);
void Array_Clone_flt64 (flt64_t array[], size_t size, size_t psize);

Other types
void Array_Clone_size (size_t array[], size_t size, size_t psize);
void Array_Clone (void *array, size_t size, size_t psize);
C++
Unsigned integer types
void Array::Clone (uint8_t array[], size_t size, size_t psize);
void Array::Clone (uint16_t array[], size_t size, size_t psize);
void Array::Clone (uint32_t array[], size_t size, size_t psize);
void Array::Clone (uint64_t array[], size_t size, size_t psize);

Signed integer types
void Array::Clone (sint8_t array[], size_t size, size_t psize);
void Array::Clone (sint16_t array[], size_t size, size_t psize);
void Array::Clone (sint32_t array[], size_t size, size_t psize);
void Array::Clone (sint64_t array[], size_t size, size_t psize);

Floating-point types
void Array::Clone (flt32_t array[], size_t size, size_t psize);
void Array::Clone (flt64_t array[], size_t size, size_t psize);

Other types
void Array::Clone (size_t array[], size_t size, size_t psize);
void Array::Clone (void *array, size_t size, size_t psize);

Description: Clone pattern (few elements from beginning of array) through the entire array.

Parameters:

  • array - pointer to array, which holds pattern
  • size - size of array (count of elements)
  • psize - pattern size (count of elements to be repeated until the end of array)

Return value: None.

Data conversion

These functions convert array elements to different floating-point and integer types, using current rounding mode which is set in the MXCSR register of processor. They use SIMD extension for data conversion, and that is why they ignoring FPU rounding mode.

Conversion between floating-point types

Cvoid Array_ConvertToFlt32_flt64 (flt32_t target[], const flt64_t source[], size_t size);
void Array_ConvertToFlt64_flt32 (flt64_t target[], const flt32_t source[], size_t size);
C++void Array::ConvertToFlt32 (flt32_t target[], const flt64_t source[], size_t size);
void Array::ConvertToFlt64 (flt64_t target[], const flt32_t source[], size_t size);

Description: Convert source array elements from one floating-point type to another, and store converted elements to target array.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Note:Array elements are rounded according to the current SIMD rounding mode.

Conversion from signed integer types to floating-point types

Cvoid Array_ConvertToFlt32_sint32 (flt32_t target[], const sint32_t source[], size_t size);
void Array_ConvertToFlt32_sint64 (flt32_t target[], const sint64_t source[], size_t size);
void Array_ConvertToFlt64_sint32 (flt64_t target[], const sint32_t source[], size_t size);
void Array_ConvertToFlt64_sint64 (flt64_t target[], const sint64_t source[], size_t size);
C++void Array::ConvertToFlt32 (flt32_t target[], const sint32_t source[], size_t size);
void Array::ConvertToFlt32 (flt32_t target[], const sint64_t source[], size_t size);
void Array::ConvertToFlt64 (flt64_t target[], const sint32_t source[], size_t size);
void Array::ConvertToFlt64 (flt64_t target[], const sint64_t source[], size_t size);

Description: Convert source array elements from signed integer type to different floating-point types, and store converted elements to target array.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Conversion from floating-point types to signed integer types

Cvoid Array_ConvertToSint32_flt32 (sint32_t target[], const flt32_t source[], size_t size);
void Array_ConvertToSint32_flt64 (sint32_t target[], const flt64_t source[], size_t size);
void Array_ConvertToSint64_flt32 (sint64_t target[], const flt32_t source[], size_t size);
void Array_ConvertToSint64_flt64 (sint64_t target[], const flt64_t source[], size_t size);
C++void Array::ConvertToSint32 (sint32_t target[], const flt32_t source[], size_t size);
void Array::ConvertToSint32 (sint32_t target[], const flt64_t source[], size_t size);
void Array::ConvertToSint64 (sint64_t target[], const flt32_t source[], size_t size);
void Array::ConvertToSint64 (sint64_t target[], const flt64_t source[], size_t size);

Description: Convert source array elements from different floating-point types to signed integer type, and store converted elements to target array.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Note:Array elements are rounded according to the current SIMD rounding mode.

Truncating from floating-point types to signed integer types

Cvoid Array_TruncateToSint32_flt32 (sint32_t target[], const flt32_t source[], size_t size);
void Array_TruncateToSint32_flt64 (sint32_t target[], const flt64_t source[], size_t size);
void Array_TruncateToSint64_flt32 (sint64_t target[], const flt32_t source[], size_t size);
void Array_TruncateToSint64_flt64 (sint64_t target[], const flt64_t source[], size_t size);
C++void Array::TruncateToSint32 (sint32_t target[], const flt32_t source[], size_t size);
void Array::TruncateToSint32 (sint32_t target[], const flt64_t source[], size_t size);
void Array::TruncateToSint64 (sint64_t target[], const flt32_t source[], size_t size);
void Array::TruncateToSint64 (sint64_t target[], const flt64_t source[], size_t size);

Description: Convert source array elements from different floating-point types to signed integer type, using round to zero (truncate) mode, and store converted elements to target array.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Bit field operations

Bit field operations treat array as continuous bit bield, which stores sequence of independent bits. You may extract bit values from there or change any bit without touching its neighbors. All operations touch only one bit per function call.

Get bit value from bit field

C
Unsigned integer types
bool Array_GetBit_uint8 (const uint8_t array[], size_t index);
bool Array_GetBit_uint16 (const uint16_t array[], size_t index);
bool Array_GetBit_uint32 (const uint32_t array[], size_t index);
bool Array_GetBit_uint64 (const uint64_t array[], size_t index);

Signed integer types
bool Array_GetBit_sint8 (const sint8_t array[], size_t index);
bool Array_GetBit_sint16 (const sint16_t array[], size_t index);
bool Array_GetBit_sint32 (const sint32_t array[], size_t index);
bool Array_GetBit_sint64 (const sint64_t array[], size_t index);

Other types
bool Array_GetBit_size (const size_t array[], size_t index);
bool Array_GetBit (const void *array, size_t index);
C++
Unsigned integer types
bool Array::GetBit (const uint8_t array[], size_t index);
bool Array::GetBit (const uint16_t array[], size_t index);
bool Array::GetBit (const uint32_t array[], size_t index);
bool Array::GetBit (const uint64_t array[], size_t index);

Signed integer types
bool Array::GetBit (const sint8_t array[], size_t index);
bool Array::GetBit (const sint16_t array[], size_t index);
bool Array::GetBit (const sint32_t array[], size_t index);
bool Array::GetBit (const sint64_t array[], size_t index);

Other types
bool Array::GetBit (const size_t array[], size_t index);
bool Array::GetBit (const void *array, size_t index);

Description: Extract bit value from bit field, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • index - bit position. First bit has zero index.

Return value:

  • TRUE (1) if bit is set.
  • FALSE (0) if bit is not set.

Set bit value in bit field

C
Unsigned integer types
void Array_SetBit_uint8 (uint8_t array[], size_t index);
void Array_SetBit_uint16 (uint16_t array[], size_t index);
void Array_SetBit_uint32 (uint32_t array[], size_t index);
void Array_SetBit_uint64 (uint64_t array[], size_t index);

Signed integer types
void Array_SetBit_sint8 (sint8_t array[], size_t index);
void Array_SetBit_sint16 (sint16_t array[], size_t index);
void Array_SetBit_sint32 (sint32_t array[], size_t index);
void Array_SetBit_sint64 (sint64_t array[], size_t index);

Other types
void Array_SetBit_size (size_t array[], size_t index);
void Array_SetBit (void *array, size_t index);
C++
Unsigned integer types
void Array::SetBit (uint8_t array[], size_t index);
void Array::SetBit (uint16_t array[], size_t index);
void Array::SetBit (uint32_t array[], size_t index);
void Array::SetBit (uint64_t array[], size_t index);

Signed integer types
void Array::SetBit (sint8_t array[], size_t index);
void Array::SetBit (sint16_t array[], size_t index);
void Array::SetBit (sint32_t array[], size_t index);
void Array::SetBit (sint64_t array[], size_t index);

Other types
void Array::SetBit (size_t array[], size_t index);
void Array::SetBit (void *array, size_t index);

Description: Set bit value in bit field, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • index - bit position. First bit has zero index.

Return value: None.

Reset bit value in bit field

C
Unsigned integer types
void Array_ResetBit_uint8 (uint8_t array[], size_t index);
void Array_ResetBit_uint16 (uint16_t array[], size_t index);
void Array_ResetBit_uint32 (uint32_t array[], size_t index);
void Array_ResetBit_uint64 (uint64_t array[], size_t index);

Signed integer types
void Array_ResetBit_sint8 (sint8_t array[], size_t index);
void Array_ResetBit_sint16 (sint16_t array[], size_t index);
void Array_ResetBit_sint32 (sint32_t array[], size_t index);
void Array_ResetBit_sint64 (sint64_t array[], size_t index);

Other types
void Array_ResetBit_size (size_t array[], size_t index);
void Array_ResetBit (void *array, size_t index);
C++
Unsigned integer types
void Array::ResetBit (uint8_t array[], size_t index);
void Array::ResetBit (uint16_t array[], size_t index);
void Array::ResetBit (uint32_t array[], size_t index);
void Array::ResetBit (uint64_t array[], size_t index);

Signed integer types
void Array::ResetBit (sint8_t array[], size_t index);
void Array::ResetBit (sint16_t array[], size_t index);
void Array::ResetBit (sint32_t array[], size_t index);
void Array::ResetBit (sint64_t array[], size_t index);

Other types
void Array::ResetBit (size_t array[], size_t index);
void Array::ResetBit (void *array, size_t index);

Description: Reset bit value in bit field, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • index - bit position. First bit has zero index.

Return value: None.

Invert bit value in bit field

C
Unsigned integer types
void Array_InvertBit_uint8 (uint8_t array[], size_t index);
void Array_InvertBit_uint16 (uint16_t array[], size_t index);
void Array_InvertBit_uint32 (uint32_t array[], size_t index);
void Array_InvertBit_uint64 (uint64_t array[], size_t index);

Signed integer types
void Array_InvertBit_sint8 (sint8_t array[], size_t index);
void Array_InvertBit_sint16 (sint16_t array[], size_t index);
void Array_InvertBit_sint32 (sint32_t array[], size_t index);
void Array_InvertBit_sint64 (sint64_t array[], size_t index);

Other types
void Array_InvertBit_size (size_t array[], size_t index);
void Array_InvertBit (void *array, size_t index);
C++
Unsigned integer types
void Array::InvertBit (uint8_t array[], size_t index);
void Array::InvertBit (uint16_t array[], size_t index);
void Array::InvertBit (uint32_t array[], size_t index);
void Array::InvertBit (uint64_t array[], size_t index);

Signed integer types
void Array::InvertBit (sint8_t array[], size_t index);
void Array::InvertBit (sint16_t array[], size_t index);
void Array::InvertBit (sint32_t array[], size_t index);
void Array::InvertBit (sint64_t array[], size_t index);

Other types
void Array::InvertBit (size_t array[], size_t index);
void Array::InvertBit (void *array, size_t index);

Description: Invert bit value in bit field, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • index - bit position. First bit has zero index.

Return value: None.

Bitwise operations

Bitwise operations operate on one or more bit patterns or binary numerals at the level of their individual bits. They work with arrays, applying the same operation to all elements.

Byte swap

C
Unsigned integer types
void Array_ByteSwap_uint8 (uint8_t array[], size_t size);
void Array_ByteSwap_uint16 (uint16_t array[], size_t size);
void Array_ByteSwap_uint32 (uint32_t array[], size_t size);
void Array_ByteSwap_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_ByteSwap_sint8 (sint8_t array[], size_t size);
void Array_ByteSwap_sint16 (sint16_t array[], size_t size);
void Array_ByteSwap_sint32 (sint32_t array[], size_t size);
void Array_ByteSwap_sint64 (sint64_t array[], size_t size);

Other types
void Array_ByteSwap_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::ByteSwap (uint8_t array[], size_t size);
void Array::ByteSwap (uint16_t array[], size_t size);
void Array::ByteSwap (uint32_t array[], size_t size);
void Array::ByteSwap (uint64_t array[], size_t size);

Signed integer types
void Array::ByteSwap (sint8_t array[], size_t size);
void Array::ByteSwap (sint16_t array[], size_t size);
void Array::ByteSwap (sint32_t array[], size_t size);
void Array::ByteSwap (sint64_t array[], size_t size);

Other types
void Array::ByteSwap (size_t array[], size_t size);

Description: Reverse bytes order of each array element. This function is provided for converting little-endian values to big-endian format and vice versa.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Bit reversal permutation

C
Unsigned integer types
void Array_BitReverse_uint8 (uint8_t array[], size_t size);
void Array_BitReverse_uint16 (uint16_t array[], size_t size);
void Array_BitReverse_uint32 (uint32_t array[], size_t size);
void Array_BitReverse_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_BitReverse_sint8 (sint8_t array[], size_t size);
void Array_BitReverse_sint16 (sint16_t array[], size_t size);
void Array_BitReverse_sint32 (sint32_t array[], size_t size);
void Array_BitReverse_sint64 (sint64_t array[], size_t size);

Other types
void Array_BitReverse_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::BitReverse (uint8_t array[], size_t size);
void Array::BitReverse (uint16_t array[], size_t size);
void Array::BitReverse (uint32_t array[], size_t size);
void Array::BitReverse (uint64_t array[], size_t size);

Signed integer types
void Array::BitReverse (sint8_t array[], size_t size);
void Array::BitReverse (sint16_t array[], size_t size);
void Array::BitReverse (sint32_t array[], size_t size);
void Array::BitReverse (sint64_t array[], size_t size);

Other types
void Array::BitReverse (size_t array[], size_t size);

Description: Reverse bits order of each array element and store the result with reversed bits order into the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Population count

C
Unsigned integer types
void Array_PopCount_uint8 (uint8_t array[], size_t size);
void Array_PopCount_uint16 (uint16_t array[], size_t size);
void Array_PopCount_uint32 (uint32_t array[], size_t size);
void Array_PopCount_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_PopCount_sint8 (sint8_t array[], size_t size);
void Array_PopCount_sint16 (sint16_t array[], size_t size);
void Array_PopCount_sint32 (sint32_t array[], size_t size);
void Array_PopCount_sint64 (sint64_t array[], size_t size);

Other types
void Array_PopCount_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::PopCount (uint8_t array[], size_t size);
void Array::PopCount (uint16_t array[], size_t size);
void Array::PopCount (uint32_t array[], size_t size);
void Array::PopCount (uint64_t array[], size_t size);

Signed integer types
void Array::PopCount (sint8_t array[], size_t size);
void Array::PopCount (sint16_t array[], size_t size);
void Array::PopCount (sint32_t array[], size_t size);
void Array::PopCount (sint64_t array[], size_t size);

Other types
void Array::PopCount (size_t array[], size_t size);

Description: Calculate a number of bits set to 1 in each array element and store calculated value into the same array element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Bitwise NOT

C
Unsigned integer types
void Array_Not_uint8 (uint8_t array[], size_t size);
void Array_Not_uint16 (uint16_t array[], size_t size);
void Array_Not_uint32 (uint32_t array[], size_t size);
void Array_Not_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_Not_sint8 (sint8_t array[], size_t size);
void Array_Not_sint16 (sint16_t array[], size_t size);
void Array_Not_sint32 (sint32_t array[], size_t size);
void Array_Not_sint64 (sint64_t array[], size_t size);

Other types
void Array_Not_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::Not (uint8_t array[], size_t size);
void Array::Not (uint16_t array[], size_t size);
void Array::Not (uint32_t array[], size_t size);
void Array::Not (uint64_t array[], size_t size);

Signed integer types
void Array::Not (sint8_t array[], size_t size);
void Array::Not (sint16_t array[], size_t size);
void Array::Not (sint32_t array[], size_t size);
void Array::Not (sint64_t array[], size_t size);

Other types
void Array::Not (size_t array[], size_t size);

Description: Perform logical negation on each bit of array element, forming the ones complement of the given binary value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Bitwise AND

Scalar bitwise AND

C
Unsigned integer types
void Array_AndScalar_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_AndScalar_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_AndScalar_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_AndScalar_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_AndScalar_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_AndScalar_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_AndScalar_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_AndScalar_sint64 (sint64_t array[], size_t size, sint64_t value);

Other types
void Array_AndScalar_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::AndScalar (uint8_t array[], size_t size, uint8_t value);
void Array::AndScalar (uint16_t array[], size_t size, uint16_t value);
void Array::AndScalar (uint32_t array[], size_t size, uint32_t value);
void Array::AndScalar (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::AndScalar (sint8_t array[], size_t size, sint8_t value);
void Array::AndScalar (sint16_t array[], size_t size, sint16_t value);
void Array::AndScalar (sint32_t array[], size_t size, sint32_t value);
void Array::AndScalar (sint64_t array[], size_t size, sint64_t value);

Other types
void Array::AndScalar (size_t array[], size_t size, size_t value);

Description: Perform the logical AND operation on each pair of corresponding bits of array element and the value, then store result to target array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to operate with

Return value: None.

Vector bitwise AND

C
Unsigned integer types
void Array_AndVector_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_AndVector_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_AndVector_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_AndVector_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_AndVector_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_AndVector_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_AndVector_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_AndVector_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Other types
void Array_AndVector_size (size_t target[], const size_t source[], size_t size);
C++
Unsigned integer types
void Array::AndVector (uint8_t target[], const uint8_t source[], size_t size);
void Array::AndVector (uint16_t target[], const uint16_t source[], size_t size);
void Array::AndVector (uint32_t target[], const uint32_t source[], size_t size);
void Array::AndVector (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::AndVector (sint8_t target[], const sint8_t source[], size_t size);
void Array::AndVector (sint16_t target[], const sint16_t source[], size_t size);
void Array::AndVector (sint32_t target[], const sint32_t source[], size_t size);
void Array::AndVector (sint64_t target[], const sint64_t source[], size_t size);

Other types
void Array::AndVector (size_t target[], const size_t source[], size_t size);

Description: Perform the logical AND operation on each pair of corresponding bits of array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Bitwise OR

Scalar bitwise OR

C
Unsigned integer types
void Array_OrScalar_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_OrScalar_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_OrScalar_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_OrScalar_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_OrScalar_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_OrScalar_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_OrScalar_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_OrScalar_sint64 (sint64_t array[], size_t size, sint64_t value);

Other types
void Array_OrScalar_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::OrScalar (uint8_t array[], size_t size, uint8_t value);
void Array::OrScalar (uint16_t array[], size_t size, uint16_t value);
void Array::OrScalar (uint32_t array[], size_t size, uint32_t value);
void Array::OrScalar (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::OrScalar (sint8_t array[], size_t size, sint8_t value);
void Array::OrScalar (sint16_t array[], size_t size, sint16_t value);
void Array::OrScalar (sint32_t array[], size_t size, sint32_t value);
void Array::OrScalar (sint64_t array[], size_t size, sint64_t value);

Other types
void Array::OrScalar (size_t array[], size_t size, size_t value);

Description: Perform the logical inclusive OR operation on each pair of corresponding bits of array element and the value, then store result to target array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to operate with

Return value: None.

Vector bitwise OR

C
Unsigned integer types
void Array_OrVector_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_OrVector_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_OrVector_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_OrVector_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_OrVector_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_OrVector_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_OrVector_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_OrVector_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Other types
void Array_OrVector_size (size_t target[], const size_t source[], size_t size);
C++
Unsigned integer types
void Array::OrVector (uint8_t target[], const uint8_t source[], size_t size);
void Array::OrVector (uint16_t target[], const uint16_t source[], size_t size);
void Array::OrVector (uint32_t target[], const uint32_t source[], size_t size);
void Array::OrVector (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::OrVector (sint8_t target[], const sint8_t source[], size_t size);
void Array::OrVector (sint16_t target[], const sint16_t source[], size_t size);
void Array::OrVector (sint32_t target[], const sint32_t source[], size_t size);
void Array::OrVector (sint64_t target[], const sint64_t source[], size_t size);

Other types
void Array::OrVector (size_t target[], const size_t source[], size_t size);

Description: Perform the logical inclusive OR operation on each pair of corresponding bits of array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Bitwise XOR

Scalar bitwise XOR

C
Unsigned integer types
void Array_XorScalar_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_XorScalar_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_XorScalar_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_XorScalar_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_XorScalar_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_XorScalar_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_XorScalar_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_XorScalar_sint64 (sint64_t array[], size_t size, sint64_t value);

Other types
void Array_XorScalar_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::XorScalar (uint8_t array[], size_t size, uint8_t value);
void Array::XorScalar (uint16_t array[], size_t size, uint16_t value);
void Array::XorScalar (uint32_t array[], size_t size, uint32_t value);
void Array::XorScalar (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::XorScalar (sint8_t array[], size_t size, sint8_t value);
void Array::XorScalar (sint16_t array[], size_t size, sint16_t value);
void Array::XorScalar (sint32_t array[], size_t size, sint32_t value);
void Array::XorScalar (sint64_t array[], size_t size, sint64_t value);

Other types
void Array::XorScalar (size_t array[], size_t size, size_t value);

Description: Perform the logical exclusive OR operation on each pair of corresponding bits of array element and the value, then store result to target array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to operate with

Return value: None.

Vector bitwise XOR

C
Unsigned integer types
void Array_XorVector_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_XorVector_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_XorVector_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_XorVector_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_XorVector_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_XorVector_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_XorVector_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_XorVector_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Other types
void Array_XorVector_size (size_t target[], const size_t source[], size_t size);
C++
Unsigned integer types
void Array::XorVector (uint8_t target[], const uint8_t source[], size_t size);
void Array::XorVector (uint16_t target[], const uint16_t source[], size_t size);
void Array::XorVector (uint32_t target[], const uint32_t source[], size_t size);
void Array::XorVector (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::XorVector (sint8_t target[], const sint8_t source[], size_t size);
void Array::XorVector (sint16_t target[], const sint16_t source[], size_t size);
void Array::XorVector (sint32_t target[], const sint32_t source[], size_t size);
void Array::XorVector (sint64_t target[], const sint64_t source[], size_t size);

Other types
void Array::XorVector (size_t target[], const size_t source[], size_t size);

Description: Perform the logical exclusive OR operation on each pair of corresponding bits of array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Arithmetic operations

These functions provide regular arithmetic operations, which operate on array elements. They have the same functionality as typical C++ operators, but apply them to each element of arrays, using SIMD instructions.

Unary operations

Unary array operations use the same array as the source and destination point for data storage. They provide wide used unary arithmetic operations and mathematical functions for arrays.

Negative value

C
Signed integer types
void Array_Neg_sint8 (sint8_t array[], size_t size);
void Array_Neg_sint16 (sint16_t array[], size_t size);
void Array_Neg_sint32 (sint32_t array[], size_t size);
void Array_Neg_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_Neg_flt32 (flt32_t array[], size_t size);
void Array_Neg_flt64 (flt64_t array[], size_t size);
C++
Signed integer types
void Array::Neg (sint8_t array[], size_t size);
void Array::Neg (sint16_t array[], size_t size);
void Array::Neg (sint32_t array[], size_t size);
void Array::Neg (sint64_t array[], size_t size);

Floating-point types
void Array::Neg (flt32_t array[], size_t size);
void Array::Neg (flt64_t array[], size_t size);

Description: Change sign of each array element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Absolute value

C
Signed integer types
void Array_Abs_sint8 (sint8_t array[], size_t size);
void Array_Abs_sint16 (sint16_t array[], size_t size);
void Array_Abs_sint32 (sint32_t array[], size_t size);
void Array_Abs_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_Abs_flt32 (flt32_t array[], size_t size);
void Array_Abs_flt64 (flt64_t array[], size_t size);
C++
Signed integer types
void Array::Abs (sint8_t array[], size_t size);
void Array::Abs (sint16_t array[], size_t size);
void Array::Abs (sint32_t array[], size_t size);
void Array::Abs (sint64_t array[], size_t size);

Floating-point types
void Array::Abs (flt32_t array[], size_t size);
void Array::Abs (flt64_t array[], size_t size);

Description: Compute absolute value of each array element, and store it into the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Negative absolute value

C
Signed integer types
void Array_NegAbs_sint8 (sint8_t array[], size_t size);
void Array_NegAbs_sint16 (sint16_t array[], size_t size);
void Array_NegAbs_sint32 (sint32_t array[], size_t size);
void Array_NegAbs_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_NegAbs_flt32 (flt32_t array[], size_t size);
void Array_NegAbs_flt64 (flt64_t array[], size_t size);
C++
Signed integer types
void Array::NegAbs (sint8_t array[], size_t size);
void Array::NegAbs (sint16_t array[], size_t size);
void Array::NegAbs (sint32_t array[], size_t size);
void Array::NegAbs (sint64_t array[], size_t size);

Floating-point types
void Array::NegAbs (flt32_t array[], size_t size);
void Array::NegAbs (flt64_t array[], size_t size);

Description: Compute negative absolute value of each array element, and store it into the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Number sign

C
Signed integer types
void Array_Sign_sint8 (sint8_t array[], size_t size);
void Array_Sign_sint16 (sint16_t array[], size_t size);
void Array_Sign_sint32 (sint32_t array[], size_t size);
void Array_Sign_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_Sign_flt32 (flt32_t array[], size_t size);
void Array_Sign_flt64 (flt64_t array[], size_t size);
C++
Signed integer types
void Array::Sign (sint8_t array[], size_t size);
void Array::Sign (sint16_t array[], size_t size);
void Array::Sign (sint32_t array[], size_t size);
void Array::Sign (sint64_t array[], size_t size);

Floating-point types
void Array::Sign (flt32_t array[], size_t size);
void Array::Sign (flt64_t array[], size_t size);

Description: Compute sign of each array element, and store it into the same element. If element is positive, then +1 is returned. If element is negative, then -1 is returned. If element is zero, then zero is returned. If element is NaN (not a number), then NaN is also returned.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Square

Cvoid Array_Sqr_flt32 (flt32_t array[], size_t size);
void Array_Sqr_flt64 (flt64_t array[], size_t size);
C++void Array::Sqr (flt32_t array[], size_t size);
void Array::Sqr (flt64_t array[], size_t size);

Description: Compute square value of each array element, and store it into the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Square root

Cvoid Array_Sqrt_flt32 (flt32_t array[], size_t size);
void Array_Sqrt_flt64 (flt64_t array[], size_t size);
C++void Array::Sqrt (flt32_t array[], size_t size);
void Array::Sqrt (flt64_t array[], size_t size);

Description: Compute square root value of each array element, and store it into the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Binary operations

Binary array operations use both source and target arrays as the data source. They provide wide used binary arithmetic operations for arrays, and store the result to target array.

Addition

Addition functions do arithmetic addition between corresponding array elements or between array element and variable, and store result to target array elements.

Scalar additiontop

C
Unsigned integer types
void Array_AddScalar_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_AddScalar_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_AddScalar_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_AddScalar_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_AddScalar_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_AddScalar_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_AddScalar_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_AddScalar_sint64 (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array_AddScalar_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_AddScalar_flt64 (flt64_t array[], size_t size, flt64_t value);

Other types
void Array_AddScalar_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::AddScalar (uint8_t array[], size_t size, uint8_t value);
void Array::AddScalar (uint16_t array[], size_t size, uint16_t value);
void Array::AddScalar (uint32_t array[], size_t size, uint32_t value);
void Array::AddScalar (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::AddScalar (sint8_t array[], size_t size, sint8_t value);
void Array::AddScalar (sint16_t array[], size_t size, sint16_t value);
void Array::AddScalar (sint32_t array[], size_t size, sint32_t value);
void Array::AddScalar (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array::AddScalar (flt32_t array[], size_t size, flt32_t value);
void Array::AddScalar (flt64_t array[], size_t size, flt64_t value);

Other types
void Array::AddScalar (size_t array[], size_t size, size_t value);

Description: Add specified value to each array element, and store result to the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to add

Return value: None.

Vector additiontop

C
void Array_AddVector_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_AddVector_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_AddVector_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_AddVector_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_AddVector_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_AddVector_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_AddVector_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_AddVector_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array_AddVector_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_AddVector_flt64 (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array_AddVector_size (size_t target[], const size_t source[], size_t size);
C++
Unsigned integer types
void Array::AddVector (uint8_t target[], const uint8_t source[], size_t size);
void Array::AddVector (uint16_t target[], const uint16_t source[], size_t size);
void Array::AddVector (uint32_t target[], const uint32_t source[], size_t size);
void Array::AddVector (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::AddVector (sint8_t target[], const sint8_t source[], size_t size);
void Array::AddVector (sint16_t target[], const sint16_t source[], size_t size);
void Array::AddVector (sint32_t target[], const sint32_t source[], size_t size);
void Array::AddVector (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array::AddVector (flt32_t target[], const flt32_t source[], size_t size);
void Array::AddVector (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array::AddVector (size_t target[], const size_t source[], size_t size);

Description: Perform the arithmetic addition operation on each pair of corresponding array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Subtraction

Subtraction functions do arithmetic subtraction between corresponding array elements or between array element and variable, and store result to target array elements.

Scalar subtractiontop

C
Unsigned integer types
void Array_SubScalar_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_SubScalar_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_SubScalar_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_SubScalar_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_SubScalar_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_SubScalar_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_SubScalar_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_SubScalar_sint64 (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array_SubScalar_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_SubScalar_flt64 (flt64_t array[], size_t size, flt64_t value);

Other types
void Array_SubScalar_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::SubScalar (uint8_t array[], size_t size, uint8_t value);
void Array::SubScalar (uint16_t array[], size_t size, uint16_t value);
void Array::SubScalar (uint32_t array[], size_t size, uint32_t value);
void Array::SubScalar (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::SubScalar (sint8_t array[], size_t size, sint8_t value);
void Array::SubScalar (sint16_t array[], size_t size, sint16_t value);
void Array::SubScalar (sint32_t array[], size_t size, sint32_t value);
void Array::SubScalar (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array::SubScalar (flt32_t array[], size_t size, flt32_t value);
void Array::SubScalar (flt64_t array[], size_t size, flt64_t value);

Other types
void Array::SubScalar (size_t array[], size_t size, size_t value);

Description: Subtract specified value from each array element, and store result to the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to subtract

Return value: None.

Vector subtractiontop

C
void Array_SubVector_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_SubVector_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_SubVector_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_SubVector_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_SubVector_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_SubVector_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_SubVector_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_SubVector_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array_SubVector_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_SubVector_flt64 (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array_SubVector_size (size_t target[], const size_t source[], size_t size);
C++
Unsigned integer types
void Array::SubVector (uint8_t target[], const uint8_t source[], size_t size);
void Array::SubVector (uint16_t target[], const uint16_t source[], size_t size);
void Array::SubVector (uint32_t target[], const uint32_t source[], size_t size);
void Array::SubVector (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::SubVector (sint8_t target[], const sint8_t source[], size_t size);
void Array::SubVector (sint16_t target[], const sint16_t source[], size_t size);
void Array::SubVector (sint32_t target[], const sint32_t source[], size_t size);
void Array::SubVector (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array::SubVector (flt32_t target[], const flt32_t source[], size_t size);
void Array::SubVector (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array::SubVector (size_t target[], const size_t source[], size_t size);

Description: Perform the arithmetic subtraction operation on each pair of corresponding array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Reverse subtraction

Reverse subtraction functions do arithmetic subtraction in reverse order between corresponding array elements or between array element and variable, and store result to target array elements.

Scalar reverse subtractiontop

C
Unsigned integer types
void Array_ReverseSubScalar_uint8 (uint8_t array[], size_t size, uint8_t value);
void Array_ReverseSubScalar_uint16 (uint16_t array[], size_t size, uint16_t value);
void Array_ReverseSubScalar_uint32 (uint32_t array[], size_t size, uint32_t value);
void Array_ReverseSubScalar_uint64 (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array_ReverseSubScalar_sint8 (sint8_t array[], size_t size, sint8_t value);
void Array_ReverseSubScalar_sint16 (sint16_t array[], size_t size, sint16_t value);
void Array_ReverseSubScalar_sint32 (sint32_t array[], size_t size, sint32_t value);
void Array_ReverseSubScalar_sint64 (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array_ReverseSubScalar_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_ReverseSubScalar_flt64 (flt64_t array[], size_t size, flt64_t value);

Other types
void Array_ReverseSubScalar_size (size_t array[], size_t size, size_t value);
C++
Unsigned integer types
void Array::ReverseSubScalar (uint8_t array[], size_t size, uint8_t value);
void Array::ReverseSubScalar (uint16_t array[], size_t size, uint16_t value);
void Array::ReverseSubScalar (uint32_t array[], size_t size, uint32_t value);
void Array::ReverseSubScalar (uint64_t array[], size_t size, uint64_t value);

Signed integer types
void Array::ReverseSubScalar (sint8_t array[], size_t size, sint8_t value);
void Array::ReverseSubScalar (sint16_t array[], size_t size, sint16_t value);
void Array::ReverseSubScalar (sint32_t array[], size_t size, sint32_t value);
void Array::ReverseSubScalar (sint64_t array[], size_t size, sint64_t value);

Floating-point types
void Array::ReverseSubScalar (flt32_t array[], size_t size, flt32_t value);
void Array::ReverseSubScalar (flt64_t array[], size_t size, flt64_t value);

Other types
void Array::ReverseSubScalar (size_t array[], size_t size, size_t value);

Description: Subtract each array element from specified value, and store result to the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to subtract from

Return value: None.

Vector reverse subtractiontop

C
void Array_ReverseSubVector_uint8 (uint8_t target[], const uint8_t source[], size_t size);
void Array_ReverseSubVector_uint16 (uint16_t target[], const uint16_t source[], size_t size);
void Array_ReverseSubVector_uint32 (uint32_t target[], const uint32_t source[], size_t size);
void Array_ReverseSubVector_uint64 (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array_ReverseSubVector_sint8 (sint8_t target[], const sint8_t source[], size_t size);
void Array_ReverseSubVector_sint16 (sint16_t target[], const sint16_t source[], size_t size);
void Array_ReverseSubVector_sint32 (sint32_t target[], const sint32_t source[], size_t size);
void Array_ReverseSubVector_sint64 (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array_ReverseSubVector_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_ReverseSubVector_flt64 (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array_ReverseSubVector_size (size_t target[], const size_t source[], size_t size);
C++
Unsigned integer types
void Array::ReverseSubVector (uint8_t target[], const uint8_t source[], size_t size);
void Array::ReverseSubVector (uint16_t target[], const uint16_t source[], size_t size);
void Array::ReverseSubVector (uint32_t target[], const uint32_t source[], size_t size);
void Array::ReverseSubVector (uint64_t target[], const uint64_t source[], size_t size);

Signed integer types
void Array::ReverseSubVector (sint8_t target[], const sint8_t source[], size_t size);
void Array::ReverseSubVector (sint16_t target[], const sint16_t source[], size_t size);
void Array::ReverseSubVector (sint32_t target[], const sint32_t source[], size_t size);
void Array::ReverseSubVector (sint64_t target[], const sint64_t source[], size_t size);

Floating-point types
void Array::ReverseSubVector (flt32_t target[], const flt32_t source[], size_t size);
void Array::ReverseSubVector (flt64_t target[], const flt64_t source[], size_t size);

Other types
void Array::ReverseSubVector (size_t target[], const size_t source[], size_t size);

Description: Perform the reverse arithmetic subtraction operation on each pair of corresponding array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Multiplication

Multiplication functions do arithmetic multiplication between corresponding array elements or between array element and variable, and store result to target array elements.

Scalar multiplicationtop

Cvoid Array_MulScalar_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_MulScalar_flt64 (flt64_t array[], size_t size, flt64_t value);
C++void Array::MulScalar (flt32_t array[], size_t size, flt32_t value);
void Array::MulScalar (flt64_t array[], size_t size, flt64_t value);

Description: Multiply each array element to specified value, and store result to the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to multiply

Return value: None.

Vector multiplicationtop

Cvoid Array_MulVector_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_MulVector_flt64 (flt64_t target[], const flt64_t source[], size_t size);
C++void Array::MulVector (flt32_t target[], const flt32_t source[], size_t size);
void Array::MulVector (flt64_t target[], const flt64_t source[], size_t size);

Description: Perform the arithmetic multiplication operation on each pair of corresponding array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Division

Division functions do arithmetic division between corresponding array elements or between array element and variable, and store result to target array elements.

Scalar divisiontop

Cvoid Array_DivScalar_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_DivScalar_flt64 (flt64_t array[], size_t size, flt64_t value);
C++void Array::DivScalar (flt32_t array[], size_t size, flt32_t value);
void Array::DivScalar (flt64_t array[], size_t size, flt64_t value);

Description: Divide each array element to specified value, and store result to the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to divide

Return value: None.

Vector divisiontop

Cvoid Array_DivVector_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_DivVector_flt64 (flt64_t target[], const flt64_t source[], size_t size);
C++void Array::DivVector (flt32_t target[], const flt32_t source[], size_t size);
void Array::DivVector (flt64_t target[], const flt64_t source[], size_t size);

Description: Perform the arithmetic division operation on each pair of corresponding array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Reverse division

Reverse division functions do arithmetic division in reverse order between corresponding array elements or between array element and variable, and store result to target array elements.

Scalar reverse divisiontop

Cvoid Array_ReverseDivScalar_flt32 (flt32_t array[], size_t size, flt32_t value);
void Array_ReverseDivScalar_flt64 (flt64_t array[], size_t size, flt64_t value);
C++void Array::ReverseDivScalar (flt32_t array[], size_t size, flt32_t value);
void Array::ReverseDivScalar (flt64_t array[], size_t size, flt64_t value);

Description: Divide specified value to each array element, and store result to the same element.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to be divided

Return value: None.

Vector reverse divisiontop

Cvoid Array_ReverseDivVector_flt32 (flt32_t target[], const flt32_t source[], size_t size);
void Array_ReverseDivVector_flt64 (flt64_t target[], const flt64_t source[], size_t size);
C++void Array::ReverseDivVector (flt32_t target[], const flt32_t source[], size_t size);
void Array::ReverseDivVector (flt64_t target[], const flt64_t source[], size_t size);

Description: Perform the reverse arithmetic division operation on each pair of corresponding array elements, and store result to target array elements.

Parameters:

  • target - pointer to target array
  • source - pointer to source array
  • size - size of arrays (count of elements)

Return value: None.

Warning:If arrays are overlapped in memory, then content of the source array will be unexpectedly modified, and content of the target array will be also undefined.

Rounding

Round down (floor)

Cvoid Array_RoundDown_flt32 (flt32_t array[], size_t size);
void Array_RoundDown_flt64 (flt64_t array[], size_t size);
C++void Array::RoundDown (flt32_t array[], size_t size);
void Array::RoundDown (flt64_t array[], size_t size);

Description: Round all array elements to an integer values in floating-point format, using round down (floor) mode.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Round up (ceil)

Cvoid Array_RoundUp_flt32 (flt32_t array[], size_t size);
void Array_RoundUp_flt64 (flt64_t array[], size_t size);
C++void Array::RoundUp (flt32_t array[], size_t size);
void Array::RoundUp (flt64_t array[], size_t size);

Description: Round all array elements to an integer values in floating-point format, using round up (ceil) mode.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Round to nearest even integer

Cvoid Array_RoundInt_flt32 (flt32_t array[], size_t size);
void Array_RoundInt_flt64 (flt64_t array[], size_t size);
C++void Array::RoundInt (flt32_t array[], size_t size);
void Array::RoundInt (flt64_t array[], size_t size);

Description: Round all array elements to an integer values in floating-point format, using round to nearest even integer mode.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Round to nearest integer, away from zero

Cvoid Array_Round_flt32 (flt32_t array[], size_t size);
void Array_Round_flt64 (flt64_t array[], size_t size);
C++void Array::Round (flt32_t array[], size_t size);
void Array::Round (flt64_t array[], size_t size);

Description: Round all array elements to an integer values in floating-point format, using round to nearest integer, away from zero mode.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Round to nearest integer, toward zero (truncation)

Cvoid Array_Truncate_flt32 (flt32_t array[], size_t size);
void Array_Truncate_flt64 (flt64_t array[], size_t size);
C++void Array::Truncate (flt32_t array[], size_t size);
void Array::Truncate (flt64_t array[], size_t size);

Description: Round all array elements to an integer values in floating-point format, using round to nearest integer, toward zero (truncation) mode.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Fractional part

Cvoid Array_Frac_flt32 (flt32_t array[], size_t size);
void Array_Frac_flt64 (flt64_t array[], size_t size);
C++void Array::Frac (flt32_t array[], size_t size);
void Array::Frac (flt64_t array[], size_t size);

Description: Extract fractional part of array elements and store them into the same array.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Numerical integration

Numerical integration is a broad family of algorithms for calculating the numerical value of a definite integral. The functions below use values of array elements as values of some function, and find different types of definite integral from that function.

Sum of elements

Cflt32_t Array_Sum_flt32 (const flt32_t array[], size_t size);
flt64_t Array_Sum_flt64 (const flt64_t array[], size_t size);
C++flt32_t Array::Sum (const flt32_t array[], size_t size);
flt64_t Array::Sum (const flt64_t array[], size_t size);

Description: Compute sum of all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Sum of all array elements.
  • 0 (zero) if array size is zero.
  • NaN (not a number) if any element of array has NaN value.

Sum of squares

Cflt32_t Array_SumSqr_flt32 (const flt32_t array[], size_t size);
flt64_t Array_SumSqr_flt64 (const flt64_t array[], size_t size);
C++flt32_t Array::SumSqr (const flt32_t array[], size_t size);
flt64_t Array::SumSqr (const flt64_t array[], size_t size);

Description: Compute sum of squares of all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Sum of squares of all array elements.
  • 0 (zero) if array size is zero.
  • NaN (not a number) if any element of array has NaN value.

Sum of absolute values

Cflt32_t Array_SumAbs_flt32 (const flt32_t array[], size_t size);
flt64_t Array_SumAbs_flt64 (const flt64_t array[], size_t size);
C++flt32_t Array::SumAbs (const flt32_t array[], size_t size);
flt64_t Array::SumAbs (const flt64_t array[], size_t size);

Description: Compute sum of absolute values of all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Sum of absolute values of all array elements.
  • 0 (zero) if array size is zero.
  • NaN (not a number) if any element of array has NaN value.

‬Sum of multiplied values

Cflt32_t Array_SumMul_flt32 (const flt32_t array1[], const flt32_t array2[], size_t size);
flt64_t Array_SumMul_flt64 (const flt64_t array1[], const flt64_t array2[], size_t size);
C++flt32_t Array::SumMul (const flt32_t array1[], const flt32_t array2[], size_t size);
flt64_t Array::SumMul (const flt64_t array1[], const flt64_t array2[], size_t size);

Description: Multiply each pair of corresponding array elements and accumulate sum of products.

Parameters:

  • array1 - pointer to first array
  • array2 - pointer to second array
  • size - size of arrays (count of elements)

Return value:

  • Sum of multiplied values of corresponding array elements.
  • 0 (zero) if array size is zero.
  • NaN (not a number) if any element of array has NaN value.

Sum of squared differences

Cflt32_t Array_SumSqrDiff_flt32 (const flt32_t array1[], const flt32_t array2[], size_t size);
flt64_t Array_SumSqrDiff_flt64 (const flt64_t array1[], const flt64_t array2[], size_t size);
C++flt32_t Array::SumSqrDiff (const flt32_t array1[], const flt32_t array2[], size_t size);
flt64_t Array::SumSqrDiff (const flt64_t array1[], const flt64_t array2[], size_t size);

Description: Compute square of difference of each pair of corresponding array elements and accumulate sum of squares.

Parameters:

  • array1 - pointer to first array
  • array2 - pointer to second array
  • size - size of arrays (count of elements)

Return value:

  • Sum of squared differences of corresponding array elements.
  • 0 (zero) if arrays size is zero.
  • NaN (not a number) if any element of arrays has NaN value.

Sum of absolute differences

Cflt32_t Array_SumAbsDiff_flt32 (const flt32_t array1[], const flt32_t array2[], size_t size);
flt64_t Array_SumAbsDiff_flt64 (const flt64_t array1[], const flt64_t array2[], size_t size);
C++flt32_t Array::SumAbsDiff (const flt32_t array1[], const flt32_t array2[], size_t size);
flt64_t Array::SumAbsDiff (const flt64_t array1[], const flt64_t array2[], size_t size);

Description: Compute absolute value of difference of each pair of corresponding array elements and accumulate sum of absolute values.

Parameters:

  • array1 - pointer to first array
  • array2 - pointer to second array
  • size - size of arrays (count of elements)

Return value:

  • Sum of absolute differences of corresponding array elements.
  • 0 (zero) if arrays size is zero.
  • NaN (not a number) if any element of arrays has NaN value.

Minimum and maximum absolute value

Min/Max functions scan array elements for minimum and maximum absolute value, then return it as the function result. If any element of array has NaN value, then NaN value is returned.

Minimum absolute value

C
Signed integer types
uint8_t Array_MinAbs_sint8 (const sint8_t array[], size_t size);
uint16_t Array_MinAbs_sint16 (const sint16_t array[], size_t size);
uint32_t Array_MinAbs_sint32 (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array_MinAbs_flt32 (const flt32_t array[], size_t size);
flt64_t Array_MinAbs_flt64 (const flt64_t array[], size_t size);
C++
Signed integer types
uint8_t Array::MinAbs (const sint8_t array[], size_t size);
uint16_t Array::MinAbs (const sint16_t array[], size_t size);
uint32_t Array::MinAbs (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array::MinAbs (const flt32_t array[], size_t size);
flt64_t Array::MinAbs (const flt64_t array[], size_t size);

Description: Find minimum absolute value among all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Element which has minimum absolute value, ignoring its sign (ie sign is cleared).
  • 0 (zero) if size of integer array is equal to zero.
  • NaN (not a number) if array size is zero, or array has NaN values.

Maximum absolute value

C
Signed integer types
uint8_t Array_MaxAbs_sint8 (const sint8_t array[], size_t size);
uint16_t Array_MaxAbs_sint16 (const sint16_t array[], size_t size);
uint32_t Array_MaxAbs_sint32 (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array_MaxAbs_flt32 (const flt32_t array[], size_t size);
flt64_t Array_MaxAbs_flt64 (const flt64_t array[], size_t size);
C++
Signed integer types
uint8_t Array::MaxAbs (const sint8_t array[], size_t size);
uint16_t Array::MaxAbs (const sint16_t array[], size_t size);
uint32_t Array::MaxAbs (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array::MaxAbs (const flt32_t array[], size_t size);
flt64_t Array::MaxAbs (const flt64_t array[], size_t size);

Description: Find maximum absolute value among all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Element which has maximum absolute value, ignoring its sign (ie sign is cleared).
  • 0 (zero) if size of integer array is equal to zero.
  • NaN (not a number) if array size is zero, or array has NaN values.

Minimum and maximum value

Min/Max functions scan array elements for minimum and maximum value. They can scan regular and object arrays. Functions return min or max value or an index of first/last element which has min or max value.

Regular array search

Following min/max functions scan regular arrays for minimum and maximum values and return such value as the result. If any element of array has NaN value, then NaN value is returned.

Minimum value

C
Unsigned integer types
uint8_t Array_Min_uint8 (const uint8_t array[], size_t size);
uint16_t Array_Min_uint16 (const uint16_t array[], size_t size);
uint32_t Array_Min_uint32 (const uint32_t array[], size_t size);

Signed integer types
sint8_t Array_Min_sint8 (const sint8_t array[], size_t size);
sint16_t Array_Min_sint16 (const sint16_t array[], size_t size);
sint32_t Array_Min_sint32 (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array_Min_flt32 (const flt32_t array[], size_t size);
flt64_t Array_Min_flt64 (const flt64_t array[], size_t size);
C++
Unsigned integer types
uint8_t Array::Min (const uint8_t array[], size_t size);
uint16_t Array::Min (const uint16_t array[], size_t size);
uint32_t Array::Min (const uint32_t array[], size_t size);

Signed integer types
sint8_t Array::Min (const sint8_t array[], size_t size);
sint16_t Array::Min (const sint16_t array[], size_t size);
sint32_t Array::Min (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array::Min (const flt32_t array[], size_t size);
flt64_t Array::Min (const flt64_t array[], size_t size);

Description: Find minimum value among all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Minimum value of array.
  • 0 (zero) if size of integer array is equal to zero.
  • NaN (not a number) if size of floating-point array is equal to zero, or array has NaN values.

Maximum value

C
Unsigned integer types
uint8_t Array_Max_uint8 (const uint8_t array[], size_t size);
uint16_t Array_Max_uint16 (const uint16_t array[], size_t size);
uint32_t Array_Max_uint32 (const uint32_t array[], size_t size);

Signed integer types
sint8_t Array_Max_sint8 (const sint8_t array[], size_t size);
sint16_t Array_Max_sint16 (const sint16_t array[], size_t size);
sint32_t Array_Max_sint32 (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array_Max_flt32 (const flt32_t array[], size_t size);
flt64_t Array_Max_flt64 (const flt64_t array[], size_t size);
C++
Unsigned integer types
uint8_t Array::Max (const uint8_t array[], size_t size);
uint16_t Array::Max (const uint16_t array[], size_t size);
uint32_t Array::Max (const uint32_t array[], size_t size);

Signed integer types
sint8_t Array::Max (const sint8_t array[], size_t size);
sint16_t Array::Max (const sint16_t array[], size_t size);
sint32_t Array::Max (const sint32_t array[], size_t size);

Floating-point types
flt32_t Array::Max (const flt32_t array[], size_t size);
flt64_t Array::Max (const flt64_t array[], size_t size);

Description: Find maximum value among all array elements.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Maximum value of array.
  • 0 (zero) if size of integer array is equal to zero.
  • NaN (not a number) if size of floating-point array is equal to zero, or array has NaN values.

Object array search

These functions scan array of objects for minimum and maximum object value from first to last element and vice versa. Then they return an index of first/last element which has min or max value.

Minimum value

Csize_t Array_MinObjFwd (const void* array[], size_t size, Cmp func);
size_t Array_MinObjBwd (const void* array[], size_t size, Cmp func);
C++size_t Array::MinObjFwd (const void* array[], size_t size, Cmp func);
size_t Array::MinObjBwd (const void* array[], size_t size, Cmp func);

Description: Find first/last minimum value among all array elements.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • Index of first/last minimum object into array.
  • -1 if object array is empty.

Maximum value

Csize_t Array_MaxObjFwd (const void* array[], size_t size, Cmp func);
size_t Array_MaxObjBwd (const void* array[], size_t size, Cmp func);
C++size_t Array::MaxObjFwd (const void* array[], size_t size, Cmp func);
size_t Array::MaxObjBwd (const void* array[], size_t size, Cmp func);

Description: Find first/last maximum value among all array elements.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • Index of first/last maximum object into array.
  • -1 if object array is empty.

Linear search

Linear search algorithms find position of a specified value within regular arrays. These arrays usually are not sorted. For sorted arrays use binary searching algorithms, which are the best for this kind of arrays.

Bit field search

Bit field search functions treat array as continuous bit bield, which stores sequence of independent bits. Each bit does not correspond with its neighbors, but only indicates some state, which can be set (1) or reset (0). Search functions scan bit fields in both forward and backward directions for set or reset bits and return index of first/last bit which conform search condition.

Forward direction search

These functions scan bit field in forward direction for first set or reset bit. They check only specified range of bits starting from spos to epos (epos bit is the first bit outside the search range). Index of first found bit is returned as the function result.

Searching for set bittop

C
Unsigned integer types
size_t Array_FindSetBitFwd_uint8 (const uint8_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd_uint16 (const uint16_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd_uint32 (const uint32_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd_uint64 (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array_FindSetBitFwd_sint8 (const sint8_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd_sint16 (const sint16_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd_sint32 (const sint32_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd_sint64 (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array_FindSetBitFwd_size (const size_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitFwd (const void *array, size_t spos, size_t epos);
C++
Unsigned integer types
size_t Array::FindSetBitFwd (const uint8_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const uint16_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const uint32_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array::FindSetBitFwd (const sint8_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const sint16_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const sint32_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array::FindSetBitFwd (const size_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitFwd (const void *array, size_t spos, size_t epos);

Description: Search bit field in range [spos,epos) in forward direction for set bit and return position of first set bit, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • spos - bit position from where to start bit searching
  • epos - bit position where to stop bit searching (first bit outside the search range)

Return value:

  • An index of first set bit.
  • -1 if bit range has no set bits.

Searching for reset bittop

C
Unsigned integer types
size_t Array_FindResetBitFwd_uint8 (const uint8_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd_uint16 (const uint16_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd_uint32 (const uint32_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd_uint64 (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array_FindResetBitFwd_sint8 (const sint8_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd_sint16 (const sint16_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd_sint32 (const sint32_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd_sint64 (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array_FindResetBitFwd_size (const size_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitFwd (const void *array, size_t spos, size_t epos);
C++
Unsigned integer types
size_t Array::FindResetBitFwd (const uint8_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const uint16_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const uint32_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array::FindResetBitFwd (const sint8_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const sint16_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const sint32_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array::FindResetBitFwd (const size_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitFwd (const void *array, size_t spos, size_t epos);

Description: Search bit field in range [spos,epos) in forward direction for reset bit and return position of first reset bit, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • spos - bit position from where to start bit searching
  • epos - bit position where to stop bit searching (first bit outside the search range)

Return value:

  • An index of first reset bit.
  • -1 if bit range has no reset bits.

Backward direction search

These functions scan bit field in backward direction for last set or reset bit. They check only specified range of bits starting from spos to epos (epos bit is the first bit outside the search range). Index of last found bit is returned as the function result.

Searching for set bittop

C
Unsigned integer types
size_t Array_FindSetBitBwd_uint8 (const uint8_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd_uint16 (const uint16_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd_uint32 (const uint32_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd_uint64 (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array_FindSetBitBwd_sint8 (const sint8_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd_sint16 (const sint16_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd_sint32 (const sint32_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd_sint64 (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array_FindSetBitBwd_size (const size_t array[], size_t spos, size_t epos);
size_t Array_FindSetBitBwd (const void *array, size_t spos, size_t epos);
C++
Unsigned integer types
size_t Array::FindSetBitBwd (const uint8_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const uint16_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const uint32_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array::FindSetBitBwd (const sint8_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const sint16_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const sint32_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array::FindSetBitBwd (const size_t array[], size_t spos, size_t epos);
size_t Array::FindSetBitBwd (const void *array, size_t spos, size_t epos);

Description: Search bit field in range [spos,epos) in backward direction for set bit and return position of last set bit, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • spos - bit position from where to start bit searching
  • epos - bit position where to stop bit searching (first bit outside the search range)

Return value:

  • An index of last set bit.
  • -1 if bit range has no set bits.

Searching for reset bittop

C
Unsigned integer types
size_t Array_FindResetBitBwd_uint8 (const uint8_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd_uint16 (const uint16_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd_uint32 (const uint32_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd_uint64 (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array_FindResetBitBwd_sint8 (const sint8_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd_sint16 (const sint16_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd_sint32 (const sint32_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd_sint64 (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array_FindResetBitBwd_size (const size_t array[], size_t spos, size_t epos);
size_t Array_FindResetBitBwd (const void *array, size_t spos, size_t epos);
C++
Unsigned integer types
size_t Array::FindResetBitBwd (const uint8_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const uint16_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const uint32_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array::FindResetBitBwd (const sint8_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const sint16_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const sint32_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array::FindResetBitBwd (const size_t array[], size_t spos, size_t epos);
size_t Array::FindResetBitBwd (const void *array, size_t spos, size_t epos);

Description: Search bit field in range [spos,epos) in backward direction for reset bit and return position of last reset bit, treating array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • spos - bit position from where to start bit searching
  • epos - bit position where to stop bit searching (first bit outside the search range)

Return value:

  • An index of last reset bit.
  • -1 if bit range has no reset bits.

Regular array search

Next functions search regular array in forward and backward direction for the element which is equal to the specified value and return an index of first or last occurrence of the element in the array.

Forward direction search

C
Unsigned integer types
size_t Array_FindFwd_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindFwd_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindFwd_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindFwd_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindFwd_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindFwd_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindFwd_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindFwd_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindFwd_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindFwd (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindFwd (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindFwd (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindFwd (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindFwd (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindFwd (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindFwd (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindFwd (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindFwd (const size_t array[], size_t size, size_t value);

Description: Search array in forward direction for specified value and return index of its first occurrence.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to find

Return value:

  • An index of first occurrence of specified value.
  • -1 if the element was not found.

Backward direction search

C
Unsigned integer types
size_t Array_FindBwd_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindBwd_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindBwd_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindBwd_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindBwd_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindBwd_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindBwd_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindBwd_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindBwd_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindBwd (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindBwd (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindBwd (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindBwd (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindBwd (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindBwd (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindBwd (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindBwd (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindBwd (const size_t array[], size_t size, size_t value);

Description: Search array in backward direction for specified value and return index of its last occurrence.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to find

Return value:

  • An index of last occurrence of specified value.
  • -1 if the element was not found.

Object array search

Next functions search array of objects in forward and backward direction for the element which is equal to the specified value and return an index of first or last occurrence of the element in the array.

Forward direction search

Csize_t Array_FindObjFwd (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindObjFwd (const void* array[], size_t size, const void *value, Cmp func);

Description: Search array in forward direction for specified value and return index of its first occurrence.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first occurrence of specified value.
  • -1 if the element was not found.

Backward direction search

Csize_t Array_FindObjBwd (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindObjBwd (const void* array[], size_t size, const void *value, Cmp func);

Description: Search array in backward direction for specified value and return index of its last occurrence.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last occurrence of specified value.
  • -1 if the element was not found.

Binary search

Binary search algorithms find position of a specified value within a sorted array. Arrays may be sorted in ascending or descending order. Functions can be used to find elements which conform to special conditions like equal, less, great etc. They return index of first/last position of element which met the condition.

Regular array search

Next functions check regular array, which is sorted in ascending or descending order, for the element, which is conform to the specified condition, and return an index of first or last occurrence of the matched element in the array.

Ascending sort order

Searching for first equal elementtop

C
Unsigned integer types
size_t Array_FindFirstEqualAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindFirstEqualAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindFirstEqualAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindFirstEqualAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindFirstEqualAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindFirstEqualAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindFirstEqualAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindFirstEqualAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindFirstEqualAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindFirstEqualAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindFirstEqualAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindFirstEqualAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindFirstEqualAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindFirstEqualAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindFirstEqualAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindFirstEqualAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindFirstEqualAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindFirstEqualAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order for specified value and return index of its first occurrence.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of first occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for last equal elementtop

C
Unsigned integer types
size_t Array_FindLastEqualAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindLastEqualAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindLastEqualAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindLastEqualAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindLastEqualAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindLastEqualAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindLastEqualAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindLastEqualAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindLastEqualAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindLastEqualAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindLastEqualAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindLastEqualAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindLastEqualAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindLastEqualAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindLastEqualAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindLastEqualAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindLastEqualAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindLastEqualAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order for specified value and return index of its last occurrence.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of last occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater elementtop

C
Unsigned integer types
size_t Array_FindGreatAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindGreatAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindGreatAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindGreatAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindGreatAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindGreatAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindGreatAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindGreatAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindGreatAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindGreatAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindGreatAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindGreatAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindGreatAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindGreatAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindGreatAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindGreatAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindGreatAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindGreatAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order for the first element, which is greater than the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of first element, which is greater than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater or equal elementtop

C
Unsigned integer types
size_t Array_FindGreatOrEqualAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindGreatOrEqualAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindGreatOrEqualAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindGreatOrEqualAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindGreatOrEqualAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindGreatOrEqualAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindGreatOrEqualAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindGreatOrEqualAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindGreatOrEqualAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindGreatOrEqualAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindGreatOrEqualAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindGreatOrEqualAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindGreatOrEqualAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindGreatOrEqualAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindGreatOrEqualAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindGreatOrEqualAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindGreatOrEqualAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindGreatOrEqualAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order for the first element, which is greater than or equal to the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of first element, which is greater than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less elementtop

C
Unsigned integer types
size_t Array_FindLessAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindLessAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindLessAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindLessAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindLessAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindLessAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindLessAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindLessAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindLessAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindLessAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindLessAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindLessAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindLessAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindLessAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindLessAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindLessAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindLessAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindLessAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order for the last element, which is less than the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of last element, which is less than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less or equal elementtop

C
Unsigned integer types
size_t Array_FindLessOrEqualAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindLessOrEqualAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindLessOrEqualAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindLessOrEqualAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindLessOrEqualAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindLessOrEqualAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindLessOrEqualAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindLessOrEqualAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindLessOrEqualAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindLessOrEqualAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindLessOrEqualAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindLessOrEqualAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindLessOrEqualAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindLessOrEqualAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindLessOrEqualAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindLessOrEqualAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindLessOrEqualAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindLessOrEqualAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order for the last element, which is less than or equal to the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of last element, which is less than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Descending sort order

Searching for first equal elementtop

C
Unsigned integer types
size_t Array_FindFirstEqualDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindFirstEqualDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindFirstEqualDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindFirstEqualDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindFirstEqualDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindFirstEqualDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindFirstEqualDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindFirstEqualDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindFirstEqualDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindFirstEqualDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindFirstEqualDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindFirstEqualDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindFirstEqualDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindFirstEqualDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindFirstEqualDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindFirstEqualDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindFirstEqualDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindFirstEqualDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order for specified value and return index of its first occurrence.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of first occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for last equal elementtop

C
Unsigned integer types
size_t Array_FindLastEqualDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindLastEqualDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindLastEqualDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindLastEqualDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindLastEqualDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindLastEqualDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindLastEqualDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindLastEqualDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindLastEqualDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindLastEqualDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindLastEqualDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindLastEqualDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindLastEqualDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindLastEqualDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindLastEqualDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindLastEqualDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindLastEqualDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindLastEqualDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order for specified value and return index of its last occurrence.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of last occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less elementtop

C
Unsigned integer types
size_t Array_FindLessDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindLessDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindLessDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindLessDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindLessDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindLessDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindLessDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindLessDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindLessDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindLessDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindLessDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindLessDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindLessDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindLessDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindLessDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindLessDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindLessDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindLessDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order for the first element, which is less than the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of first element, which is less than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less or equal elementtop

C
Unsigned integer types
size_t Array_FindLessOrEqualDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindLessOrEqualDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindLessOrEqualDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindLessOrEqualDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindLessOrEqualDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindLessOrEqualDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindLessOrEqualDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindLessOrEqualDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindLessOrEqualDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindLessOrEqualDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindLessOrEqualDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindLessOrEqualDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindLessOrEqualDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindLessOrEqualDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindLessOrEqualDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindLessOrEqualDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindLessOrEqualDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindLessOrEqualDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order for the first element, which is less than or equal to the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of first element, which is less than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater elementtop

C
Unsigned integer types
size_t Array_FindGreatDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindGreatDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindGreatDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindGreatDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindGreatDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindGreatDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindGreatDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindGreatDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindGreatDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindGreatDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindGreatDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindGreatDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindGreatDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindGreatDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindGreatDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindGreatDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindGreatDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindGreatDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order for the last element, which is greater than the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of last element, which is greater than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater or equal elementtop

C
Unsigned integer types
size_t Array_FindGreatOrEqualDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_FindGreatOrEqualDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_FindGreatOrEqualDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_FindGreatOrEqualDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_FindGreatOrEqualDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_FindGreatOrEqualDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_FindGreatOrEqualDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_FindGreatOrEqualDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_FindGreatOrEqualDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::FindGreatOrEqualDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::FindGreatOrEqualDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::FindGreatOrEqualDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::FindGreatOrEqualDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::FindGreatOrEqualDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::FindGreatOrEqualDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::FindGreatOrEqualDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::FindGreatOrEqualDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::FindGreatOrEqualDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order for the last element, which is greater than or equal to the specified value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to process

Return value:

  • An index of last element, which is greater than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Object array search

Next functions check array of objects, which is sorted in ascending or descending order, for the element, which is conform to the specified condition, and return an index of first or last occurrence of the matched element in the array.

Ascending sort order

Searching for first equal elementtop

Csize_t Array_FindFirstEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindFirstEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order for specified value and return index of its first occurrence.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for last equal elementtop

Csize_t Array_FindLastEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindLastEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order for specified value and return index of its last occurrence.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater elementtop

Csize_t Array_FindGreatObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindGreatObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order for the first element, which is greater than the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first element, which is greater than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater or equal elementtop

Csize_t Array_FindGreatOrEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindGreatOrEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order for the first element, which is greater than or equal to the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first element, which is greater than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less elementtop

Csize_t Array_FindLessObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindLessObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order for the last element, which is less than the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last element, which is less than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less or equal elementtop

Csize_t Array_FindLessOrEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindLessOrEqualObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order for the last element, which is less than or equal to the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last element, which is less than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Descending sort order

Searching for first equal elementtop

Csize_t Array_FindFirstEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindFirstEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in descending order for specified value and return index of its first occurrence.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for last equal elementtop

Csize_t Array_FindLastEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindLastEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in deascending order for specified value and return index of its last occurrence.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last occurrence of specified value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less elementtop

Csize_t Array_FindLessObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindLessObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in descending order for the first element, which is less than the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first element, which is less than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for less or equal elementtop

Csize_t Array_FindLessOrEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindLessOrEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in descending order for the first element, which is less than or equal to the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first element, which is less than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater elementtop

Csize_t Array_FindGreatObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindGreatObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in descending order for the last element, which is greater than the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last element, which is greater than the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Searching for greater or equal elementtop

Csize_t Array_FindGreatOrEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::FindGreatOrEqualObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in descending order for the last element, which is greater than or equal to the specified value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of last element, which is greater than or equal to the value.
  • -1 if element was not found.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Linear counting

Linear counting is very simple pattern counting algorithm, which checks array element by element for required pattern, and returns a number of pattern matches were met in the array. It always check whole array even if pattern was not found.

Bit counting

C
Unsigned integer types
size_t Array_CountBits_uint8 (const uint8_t array[], size_t spos, size_t epos);
size_t Array_CountBits_uint16 (const uint16_t array[], size_t spos, size_t epos);
size_t Array_CountBits_uint32 (const uint32_t array[], size_t spos, size_t epos);
size_t Array_CountBits_uint64 (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array_CountBits_sint8 (const sint8_t array[], size_t spos, size_t epos);
size_t Array_CountBits_sint16 (const sint16_t array[], size_t spos, size_t epos);
size_t Array_CountBits_sint32 (const sint32_t array[], size_t spos, size_t epos);
size_t Array_CountBits_sint64 (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array_CountBits_size (const size_t array[], size_t spos, size_t epos);
size_t Array_CountBits (const void *array, size_t spos, size_t epos);
C++
Unsigned integer types
size_t Array::CountBits (const uint8_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const uint16_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const uint32_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const uint64_t array[], size_t spos, size_t epos);

Signed integer types
size_t Array::CountBits (const sint8_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const sint16_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const sint32_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const sint64_t array[], size_t spos, size_t epos);

Other types
size_t Array::CountBits (const size_t array[], size_t spos, size_t epos);
size_t Array::CountBits (const void *array, size_t spos, size_t epos);

Description: Search bit field in range from [spos,epos) for set bits and return total count of set bits were met. Functions treat array pointer as beginning position of the bit field. Bit index is calculated from that position. First byte has index values from 0 to 7. Second byte starts from 8 index and so on.

Parameters:

  • array - pointer to array
  • spos - bit position from where to start bit counting
  • epos - bit position where to stop bit counting (first bit outside the counting range)

Return value: The number of set bit.

Element counting

C
Unsigned integer types
size_t Array_Count_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_Count_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_Count_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_Count_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_Count_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_Count_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_Count_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_Count_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_Count_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::Count (const uint8_t array[], size_t size, uint8_t value);
size_t Array::Count (const uint16_t array[], size_t size, uint16_t value);
size_t Array::Count (const uint32_t array[], size_t size, uint32_t value);
size_t Array::Count (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::Count (const sint8_t array[], size_t size, sint8_t value);
size_t Array::Count (const sint16_t array[], size_t size, sint16_t value);
size_t Array::Count (const sint32_t array[], size_t size, sint32_t value);
size_t Array::Count (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::Count (const size_t array[], size_t size, size_t value);

Description: Search array for specified value and return the count of pattern matches were met.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to find

Return value: The number of pattern matches.

Object counting

Csize_t Array_CountObj (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::CountObj (const void* array[], size_t size, const void *value, Cmp func);

Description: Search array for specified value and return the count of pattern matches were met.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: The number of pattern matches.

Binary counting

Binary counting is very efficient way to count pattern matches in sorted array. It takes log(N) compare operations to find a number of pattern matches and works only with sorted is ascending or descending order arrays. Use appropriate function for each sort order.

Element counting

These functions implement binary counting algorithm for regular array. You must be sure that the array you use is sorted in correct order. If the array is unsorted, then the function behavior is undefined.

Ascending sort order

C
Unsigned integer types
size_t Array_CountAsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_CountAsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_CountAsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_CountAsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_CountAsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_CountAsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_CountAsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_CountAsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_CountAsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::CountAsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::CountAsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::CountAsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::CountAsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::CountAsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::CountAsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::CountAsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::CountAsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::CountAsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in ascending order, for specified value and return the count of pattern matches were met.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to find

Return value: The number of pattern matches.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Descending sort order

C
Unsigned integer types
size_t Array_CountDsc_uint8 (const uint8_t array[], size_t size, uint8_t value);
size_t Array_CountDsc_uint16 (const uint16_t array[], size_t size, uint16_t value);
size_t Array_CountDsc_uint32 (const uint32_t array[], size_t size, uint32_t value);
size_t Array_CountDsc_uint64 (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array_CountDsc_sint8 (const sint8_t array[], size_t size, sint8_t value);
size_t Array_CountDsc_sint16 (const sint16_t array[], size_t size, sint16_t value);
size_t Array_CountDsc_sint32 (const sint32_t array[], size_t size, sint32_t value);
size_t Array_CountDsc_sint64 (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array_CountDsc_size (const size_t array[], size_t size, size_t value);
C++
Unsigned integer types
size_t Array::CountDsc (const uint8_t array[], size_t size, uint8_t value);
size_t Array::CountDsc (const uint16_t array[], size_t size, uint16_t value);
size_t Array::CountDsc (const uint32_t array[], size_t size, uint32_t value);
size_t Array::CountDsc (const uint64_t array[], size_t size, uint64_t value);

Signed integer types
size_t Array::CountDsc (const sint8_t array[], size_t size, sint8_t value);
size_t Array::CountDsc (const sint16_t array[], size_t size, sint16_t value);
size_t Array::CountDsc (const sint32_t array[], size_t size, sint32_t value);
size_t Array::CountDsc (const sint64_t array[], size_t size, sint64_t value);

Other types
size_t Array::CountDsc (const size_t array[], size_t size, size_t value);

Description: Search the array, which is sorted in descending order, for specified value and return the count of pattern matches were met.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • value - value to find

Return value: The number of pattern matches.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Object counting

These functions implement binary counting algorithm for object array. You must be sure that the array you use is sorted in correct order. If the array is unsorted, then the function behavior is undefined.

Ascending sort order

Csize_t Array_CountObjAsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::CountObjAsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in ascending order, for specified value and return the count of pattern matches were met.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: The number of pattern matches.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Descending sort order

Csize_t Array_CountObjDsc (const void* array[], size_t size, const void *value, Cmp func);
C++size_t Array::CountObjDsc (const void* array[], size_t size, const void *value, Cmp func);

Description: Search the array, which is sorted in descending order, for specified value and return the count of pattern matches were met.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • value - pointer to value to find
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: The number of pattern matches.

Note:These functions work only with sorted arrays. To use them with unordered arrays they should be sorted first.

Replacing

Replace functions scan array for pattern and replace each occurrence of pattern value with the new value you specified. They scan whole array even if no pattern matches were found.

Element replacing

C
Unsigned integer types
void Array_Replace_uint8 (uint8_t array[], size_t size, uint8_t pattern, uint8_t value);
void Array_Replace_uint16 (uint16_t array[], size_t size, uint16_t pattern, uint16_t value);
void Array_Replace_uint32 (uint32_t array[], size_t size, uint32_t pattern, uint32_t value);
void Array_Replace_uint64 (uint64_t array[], size_t size, uint64_t pattern, uint64_t value);

Signed integer types
void Array_Replace_sint8 (sint8_t array[], size_t size, sint8_t pattern, sint8_t value);
void Array_Replace_sint16 (sint16_t array[], size_t size, sint16_t pattern, sint16_t value);
void Array_Replace_sint32 (sint32_t array[], size_t size, sint32_t pattern, sint32_t value);
void Array_Replace_sint64 (sint64_t array[], size_t size, sint64_t pattern, sint64_t value);

Other types
void Array_Replace_size (size_t array[], size_t size, size_t pattern, size_t value);
C++
Unsigned integer types
void Array::Replace (uint8_t array[], size_t size, uint8_t pattern, uint8_t value);
void Array::Replace (uint16_t array[], size_t size, uint16_t pattern, uint16_t value);
void Array::Replace (uint32_t array[], size_t size, uint32_t pattern, uint32_t value);
void Array::Replace (uint64_t array[], size_t size, uint64_t pattern, uint64_t value);

Signed integer types
void Array::Replace (sint8_t array[], size_t size, sint8_t pattern, sint8_t value);
void Array::Replace (sint16_t array[], size_t size, sint16_t pattern, sint16_t value);
void Array::Replace (sint32_t array[], size_t size, sint32_t pattern, sint32_t value);
void Array::Replace (sint64_t array[], size_t size, sint64_t pattern, sint64_t value);

Other types
void Array::Replace (size_t array[], size_t size, size_t pattern, size_t value);

Description: Replace all occurrences of pattern with new value.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)
  • pattern - value to find
  • value - new value which should replace pattern value

Return value: None.

Object replacing

Cvoid Array_ReplaceObj (const void* array[], size_t size, const void *pattern, const void *value, Cmp func);
C++void Array::ReplaceObj (const void* array[], size_t size, const void *pattern, const void *value, Cmp func);

Description: Replace all occurrences of pattern with new value.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • pattern - pointer to value to find
  • value - pointer to new value which should replace pattern value
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Order reversing

These functions change elements order into the array. After this procedure first element will be swapped with the last element and so on.

Regular array reversing

C
Unsigned integer types
void Array_Reverse_uint8 (uint8_t array[], size_t size);
void Array_Reverse_uint16 (uint16_t array[], size_t size);
void Array_Reverse_uint32 (uint32_t array[], size_t size);
void Array_Reverse_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_Reverse_sint8 (sint8_t array[], size_t size);
void Array_Reverse_sint16 (sint16_t array[], size_t size);
void Array_Reverse_sint32 (sint32_t array[], size_t size);
void Array_Reverse_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_Reverse_flt32 (flt32_t array[], size_t size);
void Array_Reverse_flt64 (flt64_t array[], size_t size);

Other types
void Array_Reverse_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::Reverse (uint8_t array[], size_t size);
void Array::Reverse (uint16_t array[], size_t size);
void Array::Reverse (uint32_t array[], size_t size);
void Array::Reverse (uint64_t array[], size_t size);

Signed integer types
void Array::Reverse (sint8_t array[], size_t size);
void Array::Reverse (sint16_t array[], size_t size);
void Array::Reverse (sint32_t array[], size_t size);
void Array::Reverse (sint64_t array[], size_t size);

Floating-point types
void Array::Reverse (flt32_t array[], size_t size);
void Array::Reverse (flt64_t array[], size_t size);

Other types
void Array::Reverse (size_t array[], size_t size);

Description: Change elements order to reverse order and store them in the same array.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: None.

Object array reversing

Cvoid Array_ReverseObj (const void* array[], size_t size);
C++void Array::ReverseObj (const void* array[], size_t size);

Description: Change elements order to reverse order and store them in the same array.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)

Return value: None.

Unique values

Following functions scan sorted arrays, regardless of their sort order, and extract only unique elements. Unique elements are placed in the new array, then functions return a number of unique elements. These functions require that the arrays, you provide, to be sorted in ascending or descending order. If the array is unsorted, then the functions behavior is undefined.

Unique elements

C
Unsigned integer types
size_t Array_Unique_uint8 (uint8_t unique[], const uint8_t array[], size_t size);
size_t Array_Unique_uint16 (uint16_t unique[], const uint16_t array[], size_t size);
size_t Array_Unique_uint32 (uint32_t unique[], const uint32_t array[], size_t size);
size_t Array_Unique_uint64 (uint64_t unique[], const uint64_t array[], size_t size);

Signed integer types
size_t Array_Unique_sint8 (sint8_t unique[], const sint8_t array[], size_t size);
size_t Array_Unique_sint16 (sint16_t unique[], const sint16_t array[], size_t size);
size_t Array_Unique_sint32 (sint32_t unique[], const sint32_t array[], size_t size);
size_t Array_Unique_sint64 (sint64_t unique[], const sint64_t array[], size_t size);

Other types
size_t Array_Unique_size (size_t unique[], const size_t array[], size_t size);
C++
Unsigned integer types
size_t Array::Unique (uint8_t unique[], const uint8_t array[], size_t size);
size_t Array::Unique (uint16_t unique[], const uint16_t array[], size_t size);
size_t Array::Unique (uint32_t unique[], const uint32_t array[], size_t size);
size_t Array::Unique (uint64_t unique[], const uint64_t array[], size_t size);

Signed integer types
size_t Array::Unique (sint8_t unique[], const sint8_t array[], size_t size);
size_t Array::Unique (sint16_t unique[], const sint16_t array[], size_t size);
size_t Array::Unique (sint32_t unique[], const sint32_t array[], size_t size);
size_t Array::Unique (sint64_t unique[], const sint64_t array[], size_t size);

Other types
size_t Array::Unique (size_t unique[], const size_t array[], size_t size);

Description: Remove duplicate elements from sorted array, leaving only unique values.

Parameters:

  • unique - pointer to array, where unique values will be stored. Should have the same size as source array.
  • array - pointer to sorted array
  • size - size of array (count of elements)

Return value: Count of unique elements.

Note:These functions work only with sorted arrays, regardless of sort order. To use them with regular arrays they should be sorted first.

Unique objects

Csize_t Array_UniqueObj (const void* unique[], const void* array[], size_t size, Cmp func);
C++size_t Array::UniqueObj (const void* unique[], const void* array[], size_t size, Cmp func);

Description: Remove duplicate elements from sorted array, leaving only unique values.

Parameters:

  • unique - pointer to array of pointers, where unique values will be stored. Should have the same size as source array.
  • array - pointer to sorted array of pointers
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: Count of unique elements.

Note:These functions work only with sorted arrays, regardless of sort order. To use them with regular arrays they should be sorted first.

Duplicate values

Duplicate functions scan sorted arrays, regardless of their sort order, and extract only unique elements, ignoring duplicates. Unique elements are placed in the new array, when the count array collect how many times each element was met in the original array. These functions require that the arrays, you provide, to be sorted in ascending or descending order. If the array is unsorted, then the functions behavior is undefined.

Duplicate elements

C
Unsigned integer types
size_t Array_Duplicates_uint8 (uint8_t unique[], size_t count[], const uint8_t array[], size_t size);
size_t Array_Duplicates_uint16 (uint16_t unique[], size_t count[], const uint16_t array[], size_t size);
size_t Array_Duplicates_uint32 (uint32_t unique[], size_t count[], const uint32_t array[], size_t size);
size_t Array_Duplicates_uint64 (uint64_t unique[], size_t count[], const uint64_t array[], size_t size);

Signed integer types
size_t Array_Duplicates_sint8 (sint8_t unique[], size_t count[], const sint8_t array[], size_t size);
size_t Array_Duplicates_sint16 (sint16_t unique[], size_t count[], const sint16_t array[], size_t size);
size_t Array_Duplicates_sint32 (sint32_t unique[], size_t count[], const sint32_t array[], size_t size);
size_t Array_Duplicates_sint64 (sint64_t unique[], size_t count[], const sint64_t array[], size_t size);

Other types
size_t Array_Duplicates_size (size_t unique[], size_t count[], const size_t array[], size_t size);
C++
Unsigned integer types
size_t Array::Duplicates (uint8_t unique[], size_t count[], const uint8_t array[], size_t size);
size_t Array::Duplicates (uint16_t unique[], size_t count[], const uint16_t array[], size_t size);
size_t Array::Duplicates (uint32_t unique[], size_t count[], const uint32_t array[], size_t size);
size_t Array::Duplicates (uint64_t unique[], size_t count[], const uint64_t array[], size_t size);

Signed integer types
size_t Array::Duplicates (sint8_t unique[], size_t count[], const sint8_t array[], size_t size);
size_t Array::Duplicates (sint16_t unique[], size_t count[], const sint16_t array[], size_t size);
size_t Array::Duplicates (sint32_t unique[], size_t count[], const sint32_t array[], size_t size);
size_t Array::Duplicates (sint64_t unique[], size_t count[], const sint64_t array[], size_t size);

Other types
size_t Array::Duplicates (size_t unique[], size_t count[], const size_t array[], size_t size);

Description: Collect unique values from source array and count how many times each unique value is met into array.

Parameters:

  • unique - pointer to array, where unique values will be stored. Should have the same size as source array.
  • count - pointer to array, where stored count of duplicates for each unique value. Should have the same size as source array.
  • array - pointer to sorted array
  • size - size of array (count of elements)

Return value: Count of unique elements.

Note:These functions work only with sorted arrays, regardless of sort order. To use them with regular arrays they should be sorted first.

Duplicate objects

Csize_t Array_DuplicatesObj (const void* unique[], size_t count[], const void* array[], size_t size, Cmp func);
C++size_t Array::DuplicatesObj (const void* unique[], size_t count[], const void* array[], size_t size, Cmp func);

Description: Collect unique values from source array and count how many times each unique value is met into array.

Parameters:

  • unique - pointer to array of pointers, where unique values will be stored. Should have the same size as source array.
  • count - pointer to array, where stored count of duplicates for each unique value. Should have the same size as source array.
  • array - pointer to sorted array of pointers
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: Count of unique elements.

Note:These functions work only with sorted arrays, regardless of sort order. To use them with regular arrays they should be sorted first.

Insertion sort

Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large arrays than more advanced algorithms such as quicksort or merge sort, but it is stable. Stable sorting algorithms maintain the relative order of elements with equal keys.

Regular array sorting

Array sorting algorithms sort regular arrays in ascending or descending order. This is very typical task for data analysis, and wide range of regular programs.

Ascending sort order

C
Unsigned integer types
void Array_InsertSortAsc_uint8 (uint8_t array[], size_t size);
void Array_InsertSortAsc_uint16 (uint16_t array[], size_t size);
void Array_InsertSortAsc_uint32 (uint32_t array[], size_t size);
void Array_InsertSortAsc_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_InsertSortAsc_sint8 (sint8_t array[], size_t size);
void Array_InsertSortAsc_sint16 (sint16_t array[], size_t size);
void Array_InsertSortAsc_sint32 (sint32_t array[], size_t size);
void Array_InsertSortAsc_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_InsertSortAsc_flt32 (flt32_t array[], size_t size);
void Array_InsertSortAsc_flt64 (flt64_t array[], size_t size);

Other types
void Array_InsertSortAsc_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::InsertSortAsc (uint8_t array[], size_t size);
void Array::InsertSortAsc (uint16_t array[], size_t size);
void Array::InsertSortAsc (uint32_t array[], size_t size);
void Array::InsertSortAsc (uint64_t array[], size_t size);

Signed integer types
void Array::InsertSortAsc (sint8_t array[], size_t size);
void Array::InsertSortAsc (sint16_t array[], size_t size);
void Array::InsertSortAsc (sint32_t array[], size_t size);
void Array::InsertSortAsc (sint64_t array[], size_t size);

Floating-point types
void Array::InsertSortAsc (flt32_t array[], size_t size);
void Array::InsertSortAsc (flt64_t array[], size_t size);

Other types
void Array::InsertSortAsc (size_t array[], size_t size);

Description: Sort regular arrays in ascending order using Insert sort algorithm.

Parameters:

  • array - pointer to array to sort
  • size - size of array (count of elements)

Return value: None.

Tip:Insert sort preserve the relative order of elements with equal keys. And should be used for small arrays (32 elements or less) where this option is necessary.

Descending sort order

C
Unsigned integer types
void Array_InsertSortDsc_uint8 (uint8_t array[], size_t size);
void Array_InsertSortDsc_uint16 (uint16_t array[], size_t size);
void Array_InsertSortDsc_uint32 (uint32_t array[], size_t size);
void Array_InsertSortDsc_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_InsertSortDsc_sint8 (sint8_t array[], size_t size);
void Array_InsertSortDsc_sint16 (sint16_t array[], size_t size);
void Array_InsertSortDsc_sint32 (sint32_t array[], size_t size);
void Array_InsertSortDsc_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_InsertSortDsc_flt32 (flt32_t array[], size_t size);
void Array_InsertSortDsc_flt64 (flt64_t array[], size_t size);

Other types
void Array_InsertSortDsc_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::InsertSortDsc (uint8_t array[], size_t size);
void Array::InsertSortDsc (uint16_t array[], size_t size);
void Array::InsertSortDsc (uint32_t array[], size_t size);
void Array::InsertSortDsc (uint64_t array[], size_t size);

Signed integer types
void Array::InsertSortDsc (sint8_t array[], size_t size);
void Array::InsertSortDsc (sint16_t array[], size_t size);
void Array::InsertSortDsc (sint32_t array[], size_t size);
void Array::InsertSortDsc (sint64_t array[], size_t size);

Floating-point types
void Array::InsertSortDsc (flt32_t array[], size_t size);
void Array::InsertSortDsc (flt64_t array[], size_t size);

Other types
void Array::InsertSortDsc (size_t array[], size_t size);

Description: Sort regular arrays in descending order using Insert sort algorithm.

Parameters:

  • array - pointer to array to sort
  • size - size of array (count of elements)

Return value: None.

Tip:Insert sort preserve the relative order of elements with equal keys. And should be used for small arrays (32 elements or less) where this option is necessary.

Key array sorting

Key sorting algorithms do sorting of array of keys in ascending or descending order and also do the same rearrangement for pointers to real data that are assigned to those keys. As a result, your complex data will be sorted by provided field, which values are stored in keys array.

Ascending sort order

C
Unsigned integer types
void Array_InsertSortKeyAsc_uint8 (uint8_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_uint16 (uint16_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_uint32 (uint32_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_uint64 (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array_InsertSortKeyAsc_sint8 (sint8_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_sint16 (sint16_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_sint32 (sint32_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_sint64 (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array_InsertSortKeyAsc_flt32 (flt32_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyAsc_flt64 (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array_InsertSortKeyAsc_size (size_t key[], const void* ptr[], size_t size);
C++
Unsigned integer types
void Array::InsertSortKeyAsc (uint8_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (uint16_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (uint32_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array::InsertSortKeyAsc (sint8_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (sint16_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (sint32_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array::InsertSortKeyAsc (flt32_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyAsc (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array::InsertSortKeyAsc (size_t key[], const void* ptr[], size_t size);

Description: Sort array of keys in ascending sort order, using Insert sort algorithm, and also rearrange array of pointers to data which are assigned to those keys.

Parameters:

  • key - pointer to keys array
  • ptr - pointer to array of pointers to data
  • size - size of array (count of elements)

Return value: None.

Tip:Insert sort preserve the relative order of elements with equal keys. And should be used for small arrays (32 elements or less) where this option is necessary.

Descending sort order

C
Unsigned integer types
void Array_InsertSortKeyDsc_uint8 (uint8_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_uint16 (uint16_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_uint32 (uint32_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_uint64 (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array_InsertSortKeyDsc_sint8 (sint8_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_sint16 (sint16_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_sint32 (sint32_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_sint64 (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array_InsertSortKeyDsc_flt32 (flt32_t key[], const void* ptr[], size_t size);
void Array_InsertSortKeyDsc_flt64 (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array_InsertSortKeyDsc_size (size_t key[], const void* ptr[], size_t size);
C++
Unsigned integer types
void Array::InsertSortKeyDsc (uint8_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (uint16_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (uint32_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array::InsertSortKeyDsc (sint8_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (sint16_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (sint32_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array::InsertSortKeyDsc (flt32_t key[], const void* ptr[], size_t size);
void Array::InsertSortKeyDsc (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array::InsertSortKeyDsc (size_t key[], const void* ptr[], size_t size);

Description: Sort array of keys in descending sort order, using Insert sort algorithm, and also rearrange array of pointers to data which are assigned to those keys.

Parameters:

  • key - pointer to keys array
  • ptr - pointer to array of pointers to data
  • size - size of array (count of elements)

Return value: None.

Tip:Insert sort preserve the relative order of elements with equal keys. And should be used for small arrays (32 elements or less) where this option is necessary.

Object array sorting

Object sorting algorithms do sorting of array of pointers to user defined objects in ascending or descending order. They use custom key compare function to find relations between the objects. The objects stay unchanged during the sort procedure. The sort functions only change the array of pointers to the object to sort them in required order.

Ascending sort order

Cvoid Array_InsertSortObjAsc (const void* array[], size_t size, Cmp func);
C++void Array::InsertSortObjAsc (const void* array[], size_t size, Cmp func);

Description: Sort array of objects in ascending order using Insert sort algorithm.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Tip:Insert sort preserve the relative order of elements with equal keys. And should be used for small arrays (32 elements or less) where this option is necessary.

Descending sort order

Cvoid Array_InsertSortObjDsc (const void* array[], size_t size, Cmp func);
C++void Array::InsertSortObjDsc (const void* array[], size_t size, Cmp func);

Description: Sort array of objects in descending order using Insert sort algorithm.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Tip:Insert sort preserve the relative order of elements with equal keys. And should be used for small arrays (32 elements or less) where this option is necessary.

Quick sort

Quick sort is a sorting algorithm developed by Tony Hoare that, on average, makes N*log(N) comparisons to sort N items. In the worst case, it makes O(N2) comparisons, though this behavior is rare. Quick sort sequential and localized memory references work well with a cache. This algorithm is implemented as an in-place partitioning algorithm, and doesn't require any additional place for sorting.

Regular array sorting

Array sorting algorithms sort regular arrays in ascending or descending order. This is very typical task for data analysis, and wide range of regular programs.

Ascending sort order

C
Unsigned integer types
void Array_QuickSortAsc_uint8 (uint8_t array[], size_t size);
void Array_QuickSortAsc_uint16 (uint16_t array[], size_t size);
void Array_QuickSortAsc_uint32 (uint32_t array[], size_t size);
void Array_QuickSortAsc_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_QuickSortAsc_sint8 (sint8_t array[], size_t size);
void Array_QuickSortAsc_sint16 (sint16_t array[], size_t size);
void Array_QuickSortAsc_sint32 (sint32_t array[], size_t size);
void Array_QuickSortAsc_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_QuickSortAsc_flt32 (flt32_t array[], size_t size);
void Array_QuickSortAsc_flt64 (flt64_t array[], size_t size);

Other types
void Array_QuickSortAsc_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::QuickSortAsc (uint8_t array[], size_t size);
void Array::QuickSortAsc (uint16_t array[], size_t size);
void Array::QuickSortAsc (uint32_t array[], size_t size);
void Array::QuickSortAsc (uint64_t array[], size_t size);

Signed integer types
void Array::QuickSortAsc (sint8_t array[], size_t size);
void Array::QuickSortAsc (sint16_t array[], size_t size);
void Array::QuickSortAsc (sint32_t array[], size_t size);
void Array::QuickSortAsc (sint64_t array[], size_t size);

Floating-point types
void Array::QuickSortAsc (flt32_t array[], size_t size);
void Array::QuickSortAsc (flt64_t array[], size_t size);

Other types
void Array::QuickSortAsc (size_t array[], size_t size);

Description: Sort regular arrays in ascending order using Quick sort algorithm.

Parameters:

  • array - pointer to array to sort
  • size - size of array (count of elements)

Return value: None.

Descending sort order

C
Unsigned integer types
void Array_QuickSortDsc_uint8 (uint8_t array[], size_t size);
void Array_QuickSortDsc_uint16 (uint16_t array[], size_t size);
void Array_QuickSortDsc_uint32 (uint32_t array[], size_t size);
void Array_QuickSortDsc_uint64 (uint64_t array[], size_t size);

Signed integer types
void Array_QuickSortDsc_sint8 (sint8_t array[], size_t size);
void Array_QuickSortDsc_sint16 (sint16_t array[], size_t size);
void Array_QuickSortDsc_sint32 (sint32_t array[], size_t size);
void Array_QuickSortDsc_sint64 (sint64_t array[], size_t size);

Floating-point types
void Array_QuickSortDsc_flt32 (flt32_t array[], size_t size);
void Array_QuickSortDsc_flt64 (flt64_t array[], size_t size);

Other types
void Array_QuickSortDsc_size (size_t array[], size_t size);
C++
Unsigned integer types
void Array::QuickSortDsc (uint8_t array[], size_t size);
void Array::QuickSortDsc (uint16_t array[], size_t size);
void Array::QuickSortDsc (uint32_t array[], size_t size);
void Array::QuickSortDsc (uint64_t array[], size_t size);

Signed integer types
void Array::QuickSortDsc (sint8_t array[], size_t size);
void Array::QuickSortDsc (sint16_t array[], size_t size);
void Array::QuickSortDsc (sint32_t array[], size_t size);
void Array::QuickSortDsc (sint64_t array[], size_t size);

Floating-point types
void Array::QuickSortDsc (flt32_t array[], size_t size);
void Array::QuickSortDsc (flt64_t array[], size_t size);

Other types
void Array::QuickSortDsc (size_t array[], size_t size);

Description: Sort regular arrays in descending order using Quick sort algorithm.

Parameters:

  • array - pointer to array to sort
  • size - size of array (count of elements)

Return value: None.

Key array sorting

Key sorting algorithms do sorting of array of keys in ascending or descending order and also do the same rearrangement for pointers to real data that are assigned to those keys. As a result, your complex data will be sorted by provided field, which values are stored in keys array.

Ascending sort order

C
Unsigned integer types
void Array_QuickSortKeyAsc_uint8 (uint8_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_uint16 (uint16_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_uint32 (uint32_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_uint64 (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array_QuickSortKeyAsc_sint8 (sint8_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_sint16 (sint16_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_sint32 (sint32_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_sint64 (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array_QuickSortKeyAsc_flt32 (flt32_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyAsc_flt64 (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array_QuickSortKeyAsc_size (size_t key[], const void* ptr[], size_t size);
C++
Unsigned integer types
void Array::QuickSortKeyAsc (uint8_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (uint16_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (uint32_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array::QuickSortKeyAsc (sint8_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (sint16_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (sint32_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array::QuickSortKeyAsc (flt32_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyAsc (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array::QuickSortKeyAsc (size_t key[], const void* ptr[], size_t size);

Description: Sort array of keys in ascending sort order, using Quick sort algorithm, and also rearrange array of pointers to data which are assigned to those keys.

Parameters:

  • key - pointer to keys array
  • ptr - pointer to array of pointers to data
  • size - size of array (count of elements)

Return value: None.

Descending sort order

C
Unsigned integer types
void Array_QuickSortKeyDsc_uint8 (uint8_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_uint16 (uint16_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_uint32 (uint32_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_uint64 (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array_QuickSortKeyDsc_sint8 (sint8_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_sint16 (sint16_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_sint32 (sint32_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_sint64 (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array_QuickSortKeyDsc_flt32 (flt32_t key[], const void* ptr[], size_t size);
void Array_QuickSortKeyDsc_flt64 (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array_QuickSortKeyDsc_size (size_t key[], const void* ptr[], size_t size);
C++
Unsigned integer types
void Array::QuickSortKeyDsc (uint8_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (uint16_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (uint32_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (uint64_t key[], const void* ptr[], size_t size);

Signed integer types
void Array::QuickSortKeyDsc (sint8_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (sint16_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (sint32_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (sint64_t key[], const void* ptr[], size_t size);

Floating-point types
void Array::QuickSortKeyDsc (flt32_t key[], const void* ptr[], size_t size);
void Array::QuickSortKeyDsc (flt64_t key[], const void* ptr[], size_t size);

Other types
void Array::QuickSortKeyDsc (size_t key[], const void* ptr[], size_t size);

Description: Sort array of keys in descending sort order, using Quick sort algorithm, and also rearrange array of pointers to data which are assigned to those keys.

Parameters:

  • key - pointer to keys array
  • ptr - pointer to array of pointers to data
  • size - size of array (count of elements)

Return value: None.

Object array sorting

Object sorting algorithms do sorting of array of pointers to user defined objects in ascending or descending order. They use custom key compare function to find relations between the objects. The objects stay unchanged during the sort procedure. The sort functions only change the array of pointers to the object to sort them in required order.

Ascending sort order

Cvoid Array_QuickSortObjAsc (const void* array[], size_t size, Cmp func);
C++void Array::QuickSortObjAsc (const void* array[], size_t size, Cmp func);

Description: Sort array of objects in ascending order using Quick sort algorithm.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Descending sort order

Cvoid Array_QuickSortObjDsc (const void* array[], size_t size, Cmp func);
C++void Array::QuickSortObjDsc (const void* array[], size_t size, Cmp func);

Description: Sort array of objects in descending order using Quick sort algorithm.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Merge sort

Merge sort is an N*log(N) comparison-based sorting algorithm. It produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output.

Regular array sorting

Array sorting algorithms sort regular arrays in ascending or descending order. This is very typical task for data analysis, and wide range of regular programs.

Ascending sort order

C
Unsigned integer types
void Array_MergeSortAsc_uint8 (uint8_t array[], uint8_t temp[], size_t size);
void Array_MergeSortAsc_uint16 (uint16_t array[], uint16_t temp[], size_t size);
void Array_MergeSortAsc_uint32 (uint32_t array[], uint32_t temp[], size_t size);
void Array_MergeSortAsc_uint64 (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array_MergeSortAsc_sint8 (sint8_t array[], sint8_t temp[], size_t size);
void Array_MergeSortAsc_sint16 (sint16_t array[], sint16_t temp[], size_t size);
void Array_MergeSortAsc_sint32 (sint32_t array[], sint32_t temp[], size_t size);
void Array_MergeSortAsc_sint64 (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array_MergeSortAsc_flt32 (flt32_t array[], flt32_t temp[], size_t size);
void Array_MergeSortAsc_flt64 (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array_MergeSortAsc_size (size_t array[], size_t temp[], size_t size);
C++
Unsigned integer types
void Array::MergeSortAsc (uint8_t array[], uint8_t temp[], size_t size);
void Array::MergeSortAsc (uint16_t array[], uint16_t temp[], size_t size);
void Array::MergeSortAsc (uint32_t array[], uint32_t temp[], size_t size);
void Array::MergeSortAsc (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array::MergeSortAsc (sint8_t array[], sint8_t temp[], size_t size);
void Array::MergeSortAsc (sint16_t array[], sint16_t temp[], size_t size);
void Array::MergeSortAsc (sint32_t array[], sint32_t temp[], size_t size);
void Array::MergeSortAsc (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array::MergeSortAsc (flt32_t array[], flt32_t temp[], size_t size);
void Array::MergeSortAsc (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array::MergeSortAsc (size_t array[], size_t temp[], size_t size);

Description: Sort regular arrays in ascending order using Merge sort algorithm.

Parameters:

  • array - pointer to array to sort
  • temp - pointer to array, which will be used as temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Tip:Merge sort preserve the relative order of elements with equal keys. And should be used for big arrays (more than 32 elements) where this option is necessary.

Descending sort order

C
Unsigned integer types
void Array_MergeSortDsc_uint8 (uint8_t array[], uint8_t temp[], size_t size);
void Array_MergeSortDsc_uint16 (uint16_t array[], uint16_t temp[], size_t size);
void Array_MergeSortDsc_uint32 (uint32_t array[], uint32_t temp[], size_t size);
void Array_MergeSortDsc_uint64 (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array_MergeSortDsc_sint8 (sint8_t array[], sint8_t temp[], size_t size);
void Array_MergeSortDsc_sint16 (sint16_t array[], sint16_t temp[], size_t size);
void Array_MergeSortDsc_sint32 (sint32_t array[], sint32_t temp[], size_t size);
void Array_MergeSortDsc_sint64 (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array_MergeSortDsc_flt32 (flt32_t array[], flt32_t temp[], size_t size);
void Array_MergeSortDsc_flt64 (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array_MergeSortDsc_size (size_t array[], size_t temp[], size_t size);
C++
Unsigned integer types
void Array::MergeSortDsc (uint8_t array[], uint8_t temp[], size_t size);
void Array::MergeSortDsc (uint16_t array[], uint16_t temp[], size_t size);
void Array::MergeSortDsc (uint32_t array[], uint32_t temp[], size_t size);
void Array::MergeSortDsc (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array::MergeSortDsc (sint8_t array[], sint8_t temp[], size_t size);
void Array::MergeSortDsc (sint16_t array[], sint16_t temp[], size_t size);
void Array::MergeSortDsc (sint32_t array[], sint32_t temp[], size_t size);
void Array::MergeSortDsc (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array::MergeSortDsc (flt32_t array[], flt32_t temp[], size_t size);
void Array::MergeSortDsc (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array::MergeSortDsc (size_t array[], size_t temp[], size_t size);

Description: Sort regular arrays in descending order using Merge sort algorithm.

Parameters:

  • array - pointer to array to sort
  • temp - pointer to array, which will be used as temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Tip:Merge sort preserve the relative order of elements with equal keys. And should be used for big arrays (more than 32 elements) where this option is necessary.

Key array sorting

Key sorting algorithms do sorting of array of keys in ascending or descending order and also do the same rearrangement for pointers to real data that are assigned to those keys. As a result, your complex data will be sorted by provided field, which values are stored in keys array.

Ascending sort order

C
Unsigned integer types
void Array_MergeSortKeyAsc_uint8 (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_uint16 (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_uint32 (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_uint64 (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array_MergeSortKeyAsc_sint8 (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_sint16 (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_sint32 (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_sint64 (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array_MergeSortKeyAsc_flt32 (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyAsc_flt64 (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array_MergeSortKeyAsc_size (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);
C++
Unsigned integer types
void Array::MergeSortKeyAsc (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array::MergeSortKeyAsc (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array::MergeSortKeyAsc (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyAsc (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array::MergeSortKeyAsc (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);

Description: Sort array of keys in ascending sort order, using Merge sort algorithm, and also rearrange array of pointers to data which are assigned to those keys.

Parameters:

  • key - pointer to key array to sort
  • ptr - pointer to array of pointers to data
  • tkey - pointer to key array, which will be used as a temporary buffer during the sorting process
  • tptr - pointer to array of pointers to data, which will be used as a temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Tip:Merge sort preserve the relative order of elements with equal keys. And should be used for big arrays (more than 32 elements) where this option is necessary.

Descending sort order

C
Unsigned integer types
void Array_MergeSortKeyDsc_uint8 (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_uint16 (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_uint32 (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_uint64 (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array_MergeSortKeyDsc_sint8 (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_sint16 (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_sint32 (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_sint64 (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array_MergeSortKeyDsc_flt32 (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array_MergeSortKeyDsc_flt64 (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array_MergeSortKeyDsc_size (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);
C++
Unsigned integer types
void Array::MergeSortKeyDsc (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array::MergeSortKeyDsc (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array::MergeSortKeyDsc (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array::MergeSortKeyDsc (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array::MergeSortKeyDsc (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);

Description: Sort array of keys in descending sort order, using Merge sort algorithm, and also rearrange array of pointers to data which are assigned to those keys.

Parameters:

  • key - pointer to key array to sort
  • ptr - pointer to array of pointers to data
  • tkey - pointer to key array, which will be used as a temporary buffer during the sorting process
  • tptr - pointer to array of pointers to data, which will be used as a temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Tip:Merge sort preserve the relative order of elements with equal keys. And should be used for big arrays (more than 32 elements) where this option is necessary.

Object array sorting

Object sorting algorithms do sorting of array of pointers to user defined objects in ascending or descending order. They use custom key compare function to find relations between the objects. The objects stay unchanged during the sort procedure. The sort functions only change the array of pointers to the object to sort them in required order.

Ascending sort order

Cvoid Array_MergeSortObjAsc (const void* array[], const void* temp[], size_t size, Cmp func);
C++void Array::MergeSortObjAsc (const void* array[], const void* temp[], size_t size, Cmp func);

Description: Sort array of objects in ascending order using Merge sort algorithm.

Parameters:

  • array - pointer to array of pointers to objects
  • temp - pointer to array, which will be used as a temporary buffer during the sorting process
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Tip:Merge sort preserve the relative order of elements with equal keys. And should be used for big arrays (more than 32 elements) where this option is necessary.

Descending sort order

Cvoid Array_MergeSortObjDsc (const void* array[], size_t size, Cmp func);
C++void Array::MergeSortObjDsc (const void* array[], size_t size, Cmp func);

Description: Sort array of objects in descending order using Merge sort algorithm.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Tip:Merge sort preserve the relative order of elements with equal keys. And should be used for big arrays (more than 32 elements) where this option is necessary.

Radix sort

Radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but because integers can represent strings of characters (e.g., names or dates) and specially formatted floating point numbers, radix sort is not limited to integers.

Regular array sorting

Array sorting algorithms sort regular arrays in ascending or descending order. This is very typical task for data analysis, and wide range of regular programs.

Ascending sort order

C
Unsigned integer types
void Array_RadixSortAsc_uint8 (uint8_t array[], uint8_t temp[], size_t size);
void Array_RadixSortAsc_uint16 (uint16_t array[], uint16_t temp[], size_t size);
void Array_RadixSortAsc_uint32 (uint32_t array[], uint32_t temp[], size_t size);
void Array_RadixSortAsc_uint64 (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array_RadixSortAsc_sint8 (sint8_t array[], sint8_t temp[], size_t size);
void Array_RadixSortAsc_sint16 (sint16_t array[], sint16_t temp[], size_t size);
void Array_RadixSortAsc_sint32 (sint32_t array[], sint32_t temp[], size_t size);
void Array_RadixSortAsc_sint64 (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array_RadixSortAsc_flt32 (flt32_t array[], flt32_t temp[], size_t size);
void Array_RadixSortAsc_flt64 (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array_RadixSortAsc_size (size_t array[], size_t temp[], size_t size);
C++
Unsigned integer types
void Array::RadixSortAsc (uint8_t array[], uint8_t temp[], size_t size);
void Array::RadixSortAsc (uint16_t array[], uint16_t temp[], size_t size);
void Array::RadixSortAsc (uint32_t array[], uint32_t temp[], size_t size);
void Array::RadixSortAsc (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array::RadixSortAsc (sint8_t array[], sint8_t temp[], size_t size);
void Array::RadixSortAsc (sint16_t array[], sint16_t temp[], size_t size);
void Array::RadixSortAsc (sint32_t array[], sint32_t temp[], size_t size);
void Array::RadixSortAsc (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array::RadixSortAsc (flt32_t array[], flt32_t temp[], size_t size);
void Array::RadixSortAsc (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array::RadixSortAsc (size_t array[], size_t temp[], size_t size);

Description: Sort regular arrays in ascending order using Radix sort algorithm.

Parameters:

  • array - pointer to array to sort
  • temp - pointer to array, which will be used as temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Descending sort order

C
Unsigned integer types
void Array_RadixSortDsc_uint8 (uint8_t array[], uint8_t temp[], size_t size);
void Array_RadixSortDsc_uint16 (uint16_t array[], uint16_t temp[], size_t size);
void Array_RadixSortDsc_uint32 (uint32_t array[], uint32_t temp[], size_t size);
void Array_RadixSortDsc_uint64 (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array_RadixSortDsc_sint8 (sint8_t array[], sint8_t temp[], size_t size);
void Array_RadixSortDsc_sint16 (sint16_t array[], sint16_t temp[], size_t size);
void Array_RadixSortDsc_sint32 (sint32_t array[], sint32_t temp[], size_t size);
void Array_RadixSortDsc_sint64 (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array_RadixSortDsc_flt32 (flt32_t array[], flt32_t temp[], size_t size);
void Array_RadixSortDsc_flt64 (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array_RadixSortDsc_size (size_t array[], size_t temp[], size_t size);
C++
Unsigned integer types
void Array::RadixSortDsc (uint8_t array[], uint8_t temp[], size_t size);
void Array::RadixSortDsc (uint16_t array[], uint16_t temp[], size_t size);
void Array::RadixSortDsc (uint32_t array[], uint32_t temp[], size_t size);
void Array::RadixSortDsc (uint64_t array[], uint64_t temp[], size_t size);

Signed integer types
void Array::RadixSortDsc (sint8_t array[], sint8_t temp[], size_t size);
void Array::RadixSortDsc (sint16_t array[], sint16_t temp[], size_t size);
void Array::RadixSortDsc (sint32_t array[], sint32_t temp[], size_t size);
void Array::RadixSortDsc (sint64_t array[], sint64_t temp[], size_t size);

Floating-point types
void Array::RadixSortDsc (flt32_t array[], flt32_t temp[], size_t size);
void Array::RadixSortDsc (flt64_t array[], flt64_t temp[], size_t size);

Other types
void Array::RadixSortDsc (size_t array[], size_t temp[], size_t size);

Description: Sort regular arrays in descending order using Radix sort algorithm.

Parameters:

  • array - pointer to array to sort
  • temp - pointer to array, which will be used as temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Key array sorting

Key sorting algorithms do sorting of array of keys in ascending or descending order and also do the same rearrangement for pointers to real data that are assigned to those keys. As a result, your complex data will be sorted by provided field, which values are stored in keys array.

Ascending sort order

C
Unsigned integer types
void Array_RadixSortKeyAsc_uint8 (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_uint16 (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_uint32 (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_uint64 (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array_RadixSortKeyAsc_sint8 (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_sint16 (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_sint32 (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_sint64 (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array_RadixSortKeyAsc_flt32 (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyAsc_flt64 (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array_RadixSortKeyAsc_size (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);
C++
Unsigned integer types
void Array::RadixSortKeyAsc (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array::RadixSortKeyAsc (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array::RadixSortKeyAsc (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyAsc (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array::RadixSortKeyAsc (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);

Description: Sort keys in ascending order using Radix sort algorithm.

Parameters:

  • key - pointer to key array to sort
  • ptr - pointer to array of pointers to data
  • tkey - pointer to key array, which will be used as a temporary buffer during the sorting process
  • tptr - pointer to array of pointers to data, which will be used as a temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Descending sort order

C
Unsigned integer types
void Array_RadixSortKeyDsc_uint8 (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_uint16 (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_uint32 (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_uint64 (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array_RadixSortKeyDsc_sint8 (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_sint16 (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_sint32 (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_sint64 (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array_RadixSortKeyDsc_flt32 (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array_RadixSortKeyDsc_flt64 (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array_RadixSortKeyDsc_size (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);
C++
Unsigned integer types
void Array::RadixSortKeyDsc (uint8_t key[], const void* ptr[], uint8_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (uint16_t key[], const void* ptr[], uint16_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (uint32_t key[], const void* ptr[], uint32_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (uint64_t key[], const void* ptr[], uint64_t tkey[], const void* tptr[], size_t size);

Signed integer types
void Array::RadixSortKeyDsc (sint8_t key[], const void* ptr[], sint8_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (sint16_t key[], const void* ptr[], sint16_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (sint32_t key[], const void* ptr[], sint32_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (sint64_t key[], const void* ptr[], sint64_t tkey[], const void* tptr[], size_t size);

Floating-point types
void Array::RadixSortKeyDsc (flt32_t key[], const void* ptr[], flt32_t tkey[], const void* tptr[], size_t size);
void Array::RadixSortKeyDsc (flt64_t key[], const void* ptr[], flt64_t tkey[], const void* tptr[], size_t size);

Other types
void Array::RadixSortKeyDsc (size_t key[], const void* ptr[], size_t tkey[], const void* tptr[], size_t size);

Description: Sort keys in descending order using Radix sort algorithm.

Parameters:

  • key - pointer to key array to sort
  • ptr - pointer to array of pointers to data
  • tkey - pointer to key array, which will be used as a temporary buffer during the sorting process
  • tptr - pointer to array of pointers to data, which will be used as a temporary buffer during the sorting process
  • size - size of arrays (count of elements)

Return value: None.

Merging of sorted arrays

Merging of sorted arrays is very common routine for data arranging into programs. These functions implement 2-way merging of arrays into one big array. Arrays can be sorted in both orders: ascending or descending. For different sort orders, you have to use appropriate functions. Target array, where merged data will be placed, should have at least size1 + size2 elements to hold data from both arrays.

Regular array merging

Following functions merge regular sorted arrays into one big regular array, which size is equal to sum of sizes of source arrays. To prevent buffer overflow, you have to be sure that target array has size which is not less than size1 + size2 elements.

Ascending sort order

C
Unsigned integer types
void Array_MergeAsc_uint8 (uint8_t target[], const uint8_t source1[], size_t size1, const uint8_t source2[], size_t size2);
void Array_MergeAsc_uint16 (uint16_t target[], const uint16_t source1[], size_t size1, const uint16_t source2[], size_t size2);
void Array_MergeAsc_uint32 (uint32_t target[], const uint32_t source1[], size_t size1, const uint32_t source2[], size_t size2);
void Array_MergeAsc_uint64 (uint64_t target[], const uint64_t source1[], size_t size1, const uint64_t source2[], size_t size2);

Signed integer types
void Array_MergeAsc_sint8 (sint8_t target[], const sint8_t source1[], size_t size1, const sint8_t source2[], size_t size2);
void Array_MergeAsc_sint16 (sint16_t target[], const sint16_t source1[], size_t size1, const sint16_t source2[], size_t size2);
void Array_MergeAsc_sint32 (sint32_t target[], const sint32_t source1[], size_t size1, const sint32_t source2[], size_t size2);
void Array_MergeAsc_sint64 (sint64_t target[], const sint64_t source1[], size_t size1, const sint64_t source2[], size_t size2);

Floating-point types
void Array_MergeAsc_flt32 (flt32_t target[], const flt32_t source1[], size_t size1, const flt32_t source2[], size_t size2);
void Array_MergeAsc_flt64 (flt64_t target[], const flt64_t source1[], size_t size1, const flt64_t source2[], size_t size2);

Other types
void Array_MergeAsc_size (size_t target[], const size_t source1[], size_t size1, const size_t source2[], size_t size2);
C++
Unsigned integer types
void Array::MergeAsc (uint8_t target[], const uint8_t source1[], size_t size1, const uint8_t source2[], size_t size2);
void Array::MergeAsc (uint16_t target[], const uint16_t source1[], size_t size1, const uint16_t source2[], size_t size2);
void Array::MergeAsc (uint32_t target[], const uint32_t source1[], size_t size1, const uint32_t source2[], size_t size2);
void Array::MergeAsc (uint64_t target[], const uint64_t source1[], size_t size1, const uint64_t source2[], size_t size2);

Signed integer types
void Array::MergeAsc (sint8_t target[], const sint8_t source1[], size_t size1, const sint8_t source2[], size_t size2);
void Array::MergeAsc (sint16_t target[], const sint16_t source1[], size_t size1, const sint16_t source2[], size_t size2);
void Array::MergeAsc (sint32_t target[], const sint32_t source1[], size_t size1, const sint32_t source2[], size_t size2);
void Array::MergeAsc (sint64_t target[], const sint64_t source1[], size_t size1, const sint64_t source2[], size_t size2);

Floating-point types
void Array::MergeAsc (flt32_t target[], const flt32_t source1[], size_t size1, const flt32_t source2[], size_t size2);
void Array::MergeAsc (flt64_t target[], const flt64_t source1[], size_t size1, const flt64_t source2[], size_t size2);

Other types
void Array::MergeAsc (size_t target[], const size_t source1[], size_t size1, const size_t source2[], size_t size2);

Description: Merge two regular arrays, sorted in ascending order, into one target array which has at least size1 + size2 elements. Source arrays stay unchanged.

Parameters:

  • target - pointer to target array, where data from merged arrays will be placed
  • source1 - pointer to first source array
  • size1 - size of first array (count of elements)
  • source2 - pointer to second source array
  • size2 - size of second array (count of elements)

Return value: None.

Note:These functions work only with sorted in correct order arrays. If you try to merge unsorted arrays, then result is undefined.

Descending sort order

C
Unsigned integer types
void Array_MergeDsc_uint8 (uint8_t target[], const uint8_t source1[], size_t size1, const uint8_t source2[], size_t size2);
void Array_MergeDsc_uint16 (uint16_t target[], const uint16_t source1[], size_t size1, const uint16_t source2[], size_t size2);
void Array_MergeDsc_uint32 (uint32_t target[], const uint32_t source1[], size_t size1, const uint32_t source2[], size_t size2);
void Array_MergeDsc_uint64 (uint64_t target[], const uint64_t source1[], size_t size1, const uint64_t source2[], size_t size2);

Signed integer types
void Array_MergeDsc_sint8 (sint8_t target[], const sint8_t source1[], size_t size1, const sint8_t source2[], size_t size2);
void Array_MergeDsc_sint16 (sint16_t target[], const sint16_t source1[], size_t size1, const sint16_t source2[], size_t size2);
void Array_MergeDsc_sint32 (sint32_t target[], const sint32_t source1[], size_t size1, const sint32_t source2[], size_t size2);
void Array_MergeDsc_sint64 (sint64_t target[], const sint64_t source1[], size_t size1, const sint64_t source2[], size_t size2);

Floating-point types
void Array_MergeDsc_flt32 (flt32_t target[], const flt32_t source1[], size_t size1, const flt32_t source2[], size_t size2);
void Array_MergeDsc_flt64 (flt64_t target[], const flt64_t source1[], size_t size1, const flt64_t source2[], size_t size2);

Other types
void Array_MergeDsc_size (size_t target[], const size_t source1[], size_t size1, const size_t source2[], size_t size2);
C++
Unsigned integer types
void Array::MergeDsc (uint8_t target[], const uint8_t source1[], size_t size1, const uint8_t source2[], size_t size2);
void Array::MergeDsc (uint16_t target[], const uint16_t source1[], size_t size1, const uint16_t source2[], size_t size2);
void Array::MergeDsc (uint32_t target[], const uint32_t source1[], size_t size1, const uint32_t source2[], size_t size2);
void Array::MergeDsc (uint64_t target[], const uint64_t source1[], size_t size1, const uint64_t source2[], size_t size2);

Signed integer types
void Array::MergeDsc (sint8_t target[], const sint8_t source1[], size_t size1, const sint8_t source2[], size_t size2);
void Array::MergeDsc (sint16_t target[], const sint16_t source1[], size_t size1, const sint16_t source2[], size_t size2);
void Array::MergeDsc (sint32_t target[], const sint32_t source1[], size_t size1, const sint32_t source2[], size_t size2);
void Array::MergeDsc (sint64_t target[], const sint64_t source1[], size_t size1, const sint64_t source2[], size_t size2);

Floating-point types
void Array::MergeDsc (flt32_t target[], const flt32_t source1[], size_t size1, const flt32_t source2[], size_t size2);
void Array::MergeDsc (flt64_t target[], const flt64_t source1[], size_t size1, const flt64_t source2[], size_t size2);

Other types
void Array::MergeDsc (size_t target[], const size_t source1[], size_t size1, const size_t source2[], size_t size2);

Description: Merge two regular arrays, sorted in descending order, into one target array which has at least size1 + size2 elements. Source arrays stay unchanged.

Parameters:

  • target - pointer to target array, where data from merged arrays will be placed
  • source1 - pointer to first source array
  • size1 - size of first array (count of elements)
  • source2 - pointer to second source array
  • size2 - size of second array (count of elements)

Return value: None.

Note:These functions work only with sorted in correct order arrays. If you try to merge unsorted arrays, then result is undefined.

Key array merging

Key merging functions merge regular arrays which hold keys, and also merge arrays of pointers which hold assigned data for selected keys. As the result, you have both keys and pointers to data, joined from different sorted array into target arrays, one for each data type. Target arrays should have at least size1 + size2 elements to hold data from merged arrays.

Ascending sort order

C
Unsigned integer types
void Array_MergeKeyAsc_uint8 (uint8_t tkey[], const void* tptr[], const uint8_t skey1[], const void* sptr1[], size_t size1, const uint8_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_uint16 (uint16_t tkey[], const void* tptr[], const uint16_t skey1[], const void* sptr1[], size_t size1, const uint16_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_uint32 (uint32_t tkey[], const void* tptr[], const uint32_t skey1[], const void* sptr1[], size_t size1, const uint32_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_uint64 (uint64_t tkey[], const void* tptr[], const uint64_t skey1[], const void* sptr1[], size_t size1, const uint64_t skey2[], const void* sptr2[], size_t size2);

Signed integer types
void Array_MergeKeyAsc_sint8 (sint8_t tkey[], const void* tptr[], const sint8_t skey1[], const void* sptr1[], size_t size1, const sint8_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_sint16 (sint16_t tkey[], const void* tptr[], const sint16_t skey1[], const void* sptr1[], size_t size1, const sint16_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_sint32 (sint32_t tkey[], const void* tptr[], const sint32_t skey1[], const void* sptr1[], size_t size1, const sint32_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_sint64 (sint64_t tkey[], const void* tptr[], const sint64_t skey1[], const void* sptr1[], size_t size1, const sint64_t skey2[], const void* sptr2[], size_t size2);

Floating-point types
void Array_MergeKeyAsc_flt32 (flt32_t tkey[], const void* tptr[], const flt32_t skey1[], const void* sptr1[], size_t size1, const flt32_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyAsc_flt64 (flt64_t tkey[], const void* tptr[], const flt64_t skey1[], const void* sptr1[], size_t size1, const flt64_t skey2[], const void* sptr2[], size_t size2);

Other types
void Array_MergeKeyAsc_size (size_t tkey[], const void* tptr[], const size_t skey1[], const void* sptr1[], size_t size1, const size_t skey2[], const void* sptr2[], size_t size2);
C++
Unsigned integer types
void Array::MergeKeyAsc (uint8_t tkey[], const void* tptr[], const uint8_t skey1[], const void* sptr1[], size_t size1, const uint8_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (uint16_t tkey[], const void* tptr[], const uint16_t skey1[], const void* sptr1[], size_t size1, const uint16_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (uint32_t tkey[], const void* tptr[], const uint32_t skey1[], const void* sptr1[], size_t size1, const uint32_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (uint64_t tkey[], const void* tptr[], const uint64_t skey1[], const void* sptr1[], size_t size1, const uint64_t skey2[], const void* sptr2[], size_t size2);

Signed integer types
void Array::MergeKeyAsc (sint8_t tkey[], const void* tptr[], const sint8_t skey1[], const void* sptr1[], size_t size1, const sint8_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (sint16_t tkey[], const void* tptr[], const sint16_t skey1[], const void* sptr1[], size_t size1, const sint16_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (sint32_t tkey[], const void* tptr[], const sint32_t skey1[], const void* sptr1[], size_t size1, const sint32_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (sint64_t tkey[], const void* tptr[], const sint64_t skey1[], const void* sptr1[], size_t size1, const sint64_t skey2[], const void* sptr2[], size_t size2);

Floating-point types
void Array::MergeKeyAsc (flt32_t tkey[], const void* tptr[], const flt32_t skey1[], const void* sptr1[], size_t size1, const flt32_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyAsc (flt64_t tkey[], const void* tptr[], const flt64_t skey1[], const void* sptr1[], size_t size1, const flt64_t skey2[], const void* sptr2[], size_t size2);

Other types
void Array::MergeKeyAsc (size_t tkey[], const void* tptr[], const size_t skey1[], const void* sptr1[], size_t size1, const size_t skey2[], const void* sptr2[], size_t size2);

Description: Merge arrays of keys, sorted in ascending order, and arrays of pointers which hold assigned data for selected keys into target arrays which have at least size1 + size2 elements. Source arrays stay unchanged.

Parameters:

  • tkey - pointer to target array of keys, where keys from merged arrays will be placed
  • tptr - pointer to target array of pointers, where pointers from merged arrays will be placed
  • skey1 - pointer to first source array of keys
  • sptr1 - pointer to first source array of pointers
  • size1 - size of first arrays of keys and pointers (count of elements)
  • skey2 - pointer to second source array of keys
  • sptr2 - pointer to second source array of pointers
  • size2 - size of second arrays of keys and pointers (count of elements)

Return value: None.

Note:These functions work only with sorted in correct order arrays. If you try to merge unsorted arrays, then result is undefined.

Descending sort order

C
Unsigned integer types
void Array_MergeKeyDsc_uint8 (uint8_t tkey[], const void* tptr[], const uint8_t skey1[], const void* sptr1[], size_t size1, const uint8_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_uint16 (uint16_t tkey[], const void* tptr[], const uint16_t skey1[], const void* sptr1[], size_t size1, const uint16_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_uint32 (uint32_t tkey[], const void* tptr[], const uint32_t skey1[], const void* sptr1[], size_t size1, const uint32_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_uint64 (uint64_t tkey[], const void* tptr[], const uint64_t skey1[], const void* sptr1[], size_t size1, const uint64_t skey2[], const void* sptr2[], size_t size2);

Signed integer types
void Array_MergeKeyDsc_sint8 (sint8_t tkey[], const void* tptr[], const sint8_t skey1[], const void* sptr1[], size_t size1, const sint8_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_sint16 (sint16_t tkey[], const void* tptr[], const sint16_t skey1[], const void* sptr1[], size_t size1, const sint16_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_sint32 (sint32_t tkey[], const void* tptr[], const sint32_t skey1[], const void* sptr1[], size_t size1, const sint32_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_sint64 (sint64_t tkey[], const void* tptr[], const sint64_t skey1[], const void* sptr1[], size_t size1, const sint64_t skey2[], const void* sptr2[], size_t size2);

Floating-point types
void Array_MergeKeyDsc_flt32 (flt32_t tkey[], const void* tptr[], const flt32_t skey1[], const void* sptr1[], size_t size1, const flt32_t skey2[], const void* sptr2[], size_t size2);
void Array_MergeKeyDsc_flt64 (flt64_t tkey[], const void* tptr[], const flt64_t skey1[], const void* sptr1[], size_t size1, const flt64_t skey2[], const void* sptr2[], size_t size2);

Other types
void Array_MergeKeyDsc_size (size_t tkey[], const void* tptr[], const size_t skey1[], const void* sptr1[], size_t size1, const size_t skey2[], const void* sptr2[], size_t size2);
C++
Unsigned integer types
void Array::MergeKeyDsc (uint8_t tkey[], const void* tptr[], const uint8_t skey1[], const void* sptr1[], size_t size1, const uint8_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (uint16_t tkey[], const void* tptr[], const uint16_t skey1[], const void* sptr1[], size_t size1, const uint16_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (uint32_t tkey[], const void* tptr[], const uint32_t skey1[], const void* sptr1[], size_t size1, const uint32_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (uint64_t tkey[], const void* tptr[], const uint64_t skey1[], const void* sptr1[], size_t size1, const uint64_t skey2[], const void* sptr2[], size_t size2);

Signed integer types
void Array::MergeKeyDsc (sint8_t tkey[], const void* tptr[], const sint8_t skey1[], const void* sptr1[], size_t size1, const sint8_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (sint16_t tkey[], const void* tptr[], const sint16_t skey1[], const void* sptr1[], size_t size1, const sint16_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (sint32_t tkey[], const void* tptr[], const sint32_t skey1[], const void* sptr1[], size_t size1, const sint32_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (sint64_t tkey[], const void* tptr[], const sint64_t skey1[], const void* sptr1[], size_t size1, const sint64_t skey2[], const void* sptr2[], size_t size2);

Floating-point types
void Array::MergeKeyDsc (flt32_t tkey[], const void* tptr[], const flt32_t skey1[], const void* sptr1[], size_t size1, const flt32_t skey2[], const void* sptr2[], size_t size2);
void Array::MergeKeyDsc (flt64_t tkey[], const void* tptr[], const flt64_t skey1[], const void* sptr1[], size_t size1, const flt64_t skey2[], const void* sptr2[], size_t size2);

Other types
void Array::MergeKeyDsc (size_t tkey[], const void* tptr[], const size_t skey1[], const void* sptr1[], size_t size1, const size_t skey2[], const void* sptr2[], size_t size2);

Description: Merge arrays of keys, sorted in descending order, and arrays of pointers which hold assigned data for selected keys into target arrays which have at least size1 + size2 elements. Source arrays stay unchanged.

Parameters:

  • tkey - pointer to target array of keys, where keys from merged arrays will be placed
  • tptr - pointer to target array of pointers, where pointers from merged arrays will be placed
  • skey1 - pointer to first source array of keys
  • sptr1 - pointer to first source array of pointers
  • size1 - size of first arrays of keys and pointers (count of elements)
  • skey2 - pointer to second source array of keys
  • sptr2 - pointer to second source array of pointers
  • size2 - size of second arrays of keys and pointers (count of elements)

Return value: None.

Note:These functions work only with sorted in correct order arrays. If you try to merge unsorted arrays, then result is undefined.

Object array merging

Following functions merge sorted array of objects into one big object array, which size is equal to sum of sizes of source arrays. To prevent buffer overflow, you have to be sure that target array has size which is not less than size1 + size2 elements.

Ascending sort order

Cvoid Array_MergeObjAsc (const void* target[], const void* source1[], size_t size1, const void* source2[], size_t size2, Cmp func);
C++void Array::MergeObjAsc (const void* target[], const void* source1[], size_t size1, const void* source2[], size_t size2, Cmp func);

Description: Merge two object arrays, sorted in ascending order, into one target array which has at least size1 + size2 elements. Source arrays stay unchanged.

Parameters:

  • target - pointer to target array of pointers, where data from merged arrays will be placed
  • source1 - pointer to first source array of pointers
  • size1 - size of first array (count of elements)
  • source2 - pointer to second source array of pointers
  • size2 - size of second array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Note:These functions work only with sorted in correct order arrays. If you try to merge unsorted arrays, then result is undefined.

Descending sort order

Cvoid Array_MergeObjDsc (const void* target[], const void* source1[], size_t size1, const void* source2[], size_t size2, Cmp func);
C++void Array::MergeObjDsc (const void* target[], const void* source1[], size_t size1, const void* source2[], size_t size2, Cmp func);

Description: Merge two object arrays, sorted in descending order, into one target array which has at least size1 + size2 elements. Source arrays stay unchanged.

Parameters:

  • target - pointer to target array of pointers, where data from merged arrays will be placed
  • source1 - pointer to first source array of pointers
  • size1 - size of first array (count of elements)
  • source2 - pointer to second source array of pointers
  • size2 - size of second array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value: None.

Note:These functions work only with sorted in correct order arrays. If you try to merge unsorted arrays, then result is undefined.

Comparison of arrays

Compare functions do trivial comparison of regular or object arrays and return relation between them: less, great or equal. Arrays are checked in forward direction from their first element until non matching pair is found. Then functions check relation between them and return three-state compare result: +1 if first array is greater than second array, -1 if it less than second array, 0 if size of arrays is equal to zero or arrays are equal.

Regular array comparison

C
Unsigned integer types
sint64_t Array_Compare_uint8 (const uint8_t array1[], const uint8_t array2[], size_t size);
sint64_t Array_Compare_uint16 (const uint16_t array1[], const uint16_t array2[], size_t size);
sint64_t Array_Compare_uint32 (const uint32_t array1[], const uint32_t array2[], size_t size);
sint64_t Array_Compare_uint64 (const uint64_t array1[], const uint64_t array2[], size_t size);

Signed integer types
sint64_t Array_Compare_sint8 (const sint8_t array1[], const sint8_t array2[], size_t size);
sint64_t Array_Compare_sint16 (const sint16_t array1[], const sint16_t array2[], size_t size);
sint64_t Array_Compare_sint32 (const sint32_t array1[], const sint32_t array2[], size_t size);
sint64_t Array_Compare_sint64 (const sint64_t array1[], const sint64_t array2[], size_t size);

Floating-point types
sint64_t Array_Compare_flt32 (const flt32_t array1[], const flt32_t array2[], size_t size);
sint64_t Array_Compare_flt64 (const flt64_t array1[], const flt64_t array2[], size_t size);

Other types
sint64_t Array_Compare_size (const size_t array1[], const size_t array2[], size_t size);
sint64_t Array_Compare (const void *array1, const void *array2, size_t size);
C++
Unsigned integer types
sint64_t Array::Compare (const uint8_t array1[], const uint8_t array2[], size_t size);
sint64_t Array::Compare (const uint16_t array1[], const uint16_t array2[], size_t size);
sint64_t Array::Compare (const uint32_t array1[], const uint32_t array2[], size_t size);
sint64_t Array::Compare (const uint64_t array1[], const uint64_t array2[], size_t size);

Signed integer types
sint64_t Array::Compare (const sint8_t array1[], const sint8_t array2[], size_t size);
sint64_t Array::Compare (const sint16_t array1[], const sint16_t array2[], size_t size);
sint64_t Array::Compare (const sint32_t array1[], const sint32_t array2[], size_t size);
sint64_t Array::Compare (const sint64_t array1[], const sint64_t array2[], size_t size);

Floating-point types
sint64_t Array::Compare (const flt32_t array1[], const flt32_t array2[], size_t size);
sint64_t Array::Compare (const flt64_t array1[], const flt64_t array2[], size_t size);

Other types
sint64_t Array::Compare (const size_t array1[], const size_t array2[], size_t size);
sint64_t Array::Compare (const void *array1, const void *array2, size_t size);

Description: Compare two arrays and return the comparison status. Comparison is done according to the elements type.

Parameters:

  • array1 - pointer to first array
  • array2 - pointer to second array
  • size - size of arrays (count of elements)

Return value:

  • -1 if first array is less than second array
  • 0 if first array is equal to second array
  • +1 if first array is greater than second array

Object array comparison

Csint64_t Array_CompareObj (const void* array1[], const void* array2[], size_t size, Cmp func);
C++sint64_t Array::CompareObj (const void* array1[], const void* array2[], size_t size, Cmp func);

Description: Compare two object arrays and return the comparison status. Comparison is done according to the specified compare function.

Parameters:

  • array1 - pointer to first array of pointers
  • array2 - pointer to second array of pointers
  • size - size of arrays (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • -1 if first object array is less than second array
  • 0 if first object array is equal to second array
  • +1 if first object array is greater than second array

Checks

Check functions look arrays for special conditions and return index of first element where the condition was met.

Check for differences

These functions look at array elements from first to last element and compare appropriate pairs to find difference between them. If such different pair is found, then functions return index of first non equal pair. If both array are empty (have zero size) or equal then -1 is returned. This means that no differences are found.

Regular array check

C
Unsigned integer types
size_t Array_CheckDiff_uint8 (const uint8_t array1[], const uint8_t array2[], size_t size);
size_t Array_CheckDiff_uint16 (const uint16_t array1[], const uint16_t array2[], size_t size);
size_t Array_CheckDiff_uint32 (const uint32_t array1[], const uint32_t array2[], size_t size);
size_t Array_CheckDiff_uint64 (const uint64_t array1[], const uint64_t array2[], size_t size);

Signed integer types
size_t Array_CheckDiff_sint8 (const sint8_t array1[], const sint8_t array2[], size_t size);
size_t Array_CheckDiff_sint16 (const sint16_t array1[], const sint16_t array2[], size_t size);
size_t Array_CheckDiff_sint32 (const sint32_t array1[], const sint32_t array2[], size_t size);
size_t Array_CheckDiff_sint64 (const sint64_t array1[], const sint64_t array2[], size_t size);

Floating-point types
size_t Array_CheckDiff_flt32 (const flt32_t array1[], const flt32_t array2[], size_t size);
size_t Array_CheckDiff_flt64 (const flt64_t array1[], const flt64_t array2[], size_t size);

Other types
size_t Array_CheckDiff_size (const size_t array1[], const size_t array2[], size_t size);
size_t Array_CheckDiff (const void *array1, const void *array2, size_t size);
C++
Unsigned integer types
size_t Array::CheckDiff (const uint8_t array1[], const uint8_t array2[], size_t size);
size_t Array::CheckDiff (const uint16_t array1[], const uint16_t array2[], size_t size);
size_t Array::CheckDiff (const uint32_t array1[], const uint32_t array2[], size_t size);
size_t Array::CheckDiff (const uint64_t array1[], const uint64_t array2[], size_t size);

Signed integer types
size_t Array::CheckDiff (const sint8_t array1[], const sint8_t array2[], size_t size);
size_t Array::CheckDiff (const sint16_t array1[], const sint16_t array2[], size_t size);
size_t Array::CheckDiff (const sint32_t array1[], const sint32_t array2[], size_t size);
size_t Array::CheckDiff (const sint64_t array1[], const sint64_t array2[], size_t size);

Floating-point types
size_t Array::CheckDiff (const flt32_t array1[], const flt32_t array2[], size_t size);
size_t Array::CheckDiff (const flt64_t array1[], const flt64_t array2[], size_t size);

Other types
size_t Array::CheckDiff (const size_t array1[], const size_t array2[], size_t size);
size_t Array::CheckDiff (const void *array1, const void *array2, size_t size);

Description: Compare arrays and return index of first different element.

Parameters:

  • array1 - pointer to first array
  • array2 - pointer to second array
  • size - size of arrays (count of elements)

Return value:

  • Index of first different element.
  • -1 if both arrays are equal.

Object array check

Csize_t Array_CheckDiffObj (const void* array1[], const void* array2[], size_t size, Cmp func);
C++size_t Array::CheckDiffObj (const void* array1[], const void* array2[], size_t size, Cmp func);

Description: Compare object arrays, using provided compare function, and return index of first different element.

Parameters:

  • array1 - pointer to first object array
  • array2 - pointer to second object array
  • size - size of arrays (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • Index of first different element.
  • -1 if both arrays are equal.

Check for duplicate values

Following functions check sorted arrays for duplicate values, and return first element which have duplicate element. The functions assume that the array, you provide, is sorted is ascending or descending order. If this is not true, then result is undefined. If no element has duplicate value, then -1 is returned.

Regular array check

C
Unsigned integer types
size_t Array_CheckDup_uint8 (const uint8_t array[], size_t size);
size_t Array_CheckDup_uint16 (const uint16_t array[], size_t size);
size_t Array_CheckDup_uint32 (const uint32_t array[], size_t size);
size_t Array_CheckDup_uint64 (const uint64_t array[], size_t size);

Signed integer types
size_t Array_CheckDup_sint8 (const sint8_t array[], size_t size);
size_t Array_CheckDup_sint16 (const sint16_t array[], size_t size);
size_t Array_CheckDup_sint32 (const sint32_t array[], size_t size);
size_t Array_CheckDup_sint64 (const sint64_t array[], size_t size);

Floating-point types
size_t Array_CheckDup_flt32 (const flt32_t array[], size_t size);
size_t Array_CheckDup_flt64 (const flt64_t array[], size_t size);

Other types
size_t Array_CheckDup_size (const size_t array[], size_t size);
C++
Unsigned integer types
size_t Array::CheckDup (const uint8_t array[], size_t size);
size_t Array::CheckDup (const uint16_t array[], size_t size);
size_t Array::CheckDup (const uint32_t array[], size_t size);
size_t Array::CheckDup (const uint64_t array[], size_t size);

Signed integer types
size_t Array::CheckDup (const sint8_t array[], size_t size);
size_t Array::CheckDup (const sint16_t array[], size_t size);
size_t Array::CheckDup (const sint32_t array[], size_t size);
size_t Array::CheckDup (const sint64_t array[], size_t size);

Floating-point types
size_t Array::CheckDup (const flt32_t array[], size_t size);
size_t Array::CheckDup (const flt64_t array[], size_t size);

Other types
size_t Array::CheckDup (const size_t array[], size_t size);

Description: Check sorted array for duplicate values and return index of first duplicate value if found.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • An index of first occurrence of duplicated value.
  • -1 if array has no duplicates.

Note:These functions work only with sorted arrays, regardless of sort order. To use them with regular arrays they should be sorted first.

Object array check

Csize_t Array_CheckDupObj (const void* array[], size_t size, Cmp func);
C++size_t Array::CheckDupObj (const void* array[], size_t size, Cmp func);

Description: Check sorted object array for duplicate values and return index of first duplicate value if found.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first occurrence of duplicated value.
  • -1 if array has no duplicates.

Note:These functions work only with sorted arrays, regardless of sort order. To use them with regular arrays they should be sorted first.

Check for sort order

Following functions check arrays for required sort order, and return an index of the first element which did not pass the sort condition.

Regular array check

Next functions check regular array for correct sort order and return position of the first element which breaks correct sort order. If no unsorted element is found, then functions return -1.

Check for ascending sort ordertop

C
Unsigned integer types
size_t Array_CheckSortAsc_uint8 (const uint8_t array[], size_t size);
size_t Array_CheckSortAsc_uint16 (const uint16_t array[], size_t size);
size_t Array_CheckSortAsc_uint32 (const uint32_t array[], size_t size);
size_t Array_CheckSortAsc_uint64 (const uint64_t array[], size_t size);

Signed integer types
size_t Array_CheckSortAsc_sint8 (const sint8_t array[], size_t size);
size_t Array_CheckSortAsc_sint16 (const sint16_t array[], size_t size);
size_t Array_CheckSortAsc_sint32 (const sint32_t array[], size_t size);
size_t Array_CheckSortAsc_sint64 (const sint64_t array[], size_t size);

Floating-point types
size_t Array_CheckSortAsc_flt32 (const flt32_t array[], size_t size);
size_t Array_CheckSortAsc_flt64 (const flt64_t array[], size_t size);

Other types
size_t Array_CheckSortAsc_size (const size_t array[], size_t size);
C++
Unsigned integer types
size_t Array::CheckSortAsc (const uint8_t array[], size_t size);
size_t Array::CheckSortAsc (const uint16_t array[], size_t size);
size_t Array::CheckSortAsc (const uint32_t array[], size_t size);
size_t Array::CheckSortAsc (const uint64_t array[], size_t size);

Signed integer types
size_t Array::CheckSortAsc (const sint8_t array[], size_t size);
size_t Array::CheckSortAsc (const sint16_t array[], size_t size);
size_t Array::CheckSortAsc (const sint32_t array[], size_t size);
size_t Array::CheckSortAsc (const sint64_t array[], size_t size);

Floating-point types
size_t Array::CheckSortAsc (const flt32_t array[], size_t size);
size_t Array::CheckSortAsc (const flt64_t array[], size_t size);

Other types
size_t Array::CheckSortAsc (const size_t array[], size_t size);

Description: Check if array is sorted in ascending sort order, and return index of first element, which position is not conform with the sort order.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • An index of first element, which position does not conform with the array sort order.
  • -1 if array is empty, or properly sorted.

Check for descending sort ordertop

C
Unsigned integer types
size_t Array_CheckSortDsc_uint8 (const uint8_t array[], size_t size);
size_t Array_CheckSortDsc_uint16 (const uint16_t array[], size_t size);
size_t Array_CheckSortDsc_uint32 (const uint32_t array[], size_t size);
size_t Array_CheckSortDsc_uint64 (const uint64_t array[], size_t size);

Signed integer types
size_t Array_CheckSortDsc_sint8 (const sint8_t array[], size_t size);
size_t Array_CheckSortDsc_sint16 (const sint16_t array[], size_t size);
size_t Array_CheckSortDsc_sint32 (const sint32_t array[], size_t size);
size_t Array_CheckSortDsc_sint64 (const sint64_t array[], size_t size);

Floating-point types
size_t Array_CheckSortDsc_flt32 (const flt32_t array[], size_t size);
size_t Array_CheckSortDsc_flt64 (const flt64_t array[], size_t size);

Other types
size_t Array_CheckSortDsc_size (const size_t array[], size_t size);
C++
Unsigned integer types
size_t Array::CheckSortDsc (const uint8_t array[], size_t size);
size_t Array::CheckSortDsc (const uint16_t array[], size_t size);
size_t Array::CheckSortDsc (const uint32_t array[], size_t size);
size_t Array::CheckSortDsc (const uint64_t array[], size_t size);

Signed integer types
size_t Array::CheckSortDsc (const sint8_t array[], size_t size);
size_t Array::CheckSortDsc (const sint16_t array[], size_t size);
size_t Array::CheckSortDsc (const sint32_t array[], size_t size);
size_t Array::CheckSortDsc (const sint64_t array[], size_t size);

Floating-point types
size_t Array::CheckSortDsc (const flt32_t array[], size_t size);
size_t Array::CheckSortDsc (const flt64_t array[], size_t size);

Other types
size_t Array::CheckSortDsc (const size_t array[], size_t size);

Description: Check if array is sorted in descending sort order, and return index of first element, which position is not conform with the sort order.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • An index of first element, which position does not conform with the array sort order.
  • -1 if array is empty, or properly sorted.

Object array check

Next functions check object array for correct sort order and return position of the first object which breaks correct sort order. If no unsorted object is found, then functions return -1.

Check for ascending sort ordertop

Csize_t Array_CheckSortObjAsc (const void* array[], size_t size, Cmp func);
C++size_t Array::CheckSortObjAsc (const void* array[], size_t size, Cmp func);

Description: Check if object array is sorted in ascending sort order, and return index of first element, which position is not conform with the sort order.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first element, which position does not conform with the array sort order.
  • -1 if array is empty, or properly sorted.

Check for descending sort ordertop

Csize_t Array_CheckSortObjDsc (const void* array[], size_t size, Cmp func);
C++size_t Array::CheckSortObjDsc (const void* array[], size_t size, Cmp func);

Description: Check if object array is sorted in descending sort order, and return index of first element, which position is not conform with the sort order.

Parameters:

  • array - pointer to array of pointers to objects
  • size - size of array (count of elements)
  • func - pointer to a key compare function. Compare function should follow this prototype.

Return value:

  • An index of first element, which position does not conform with the array sort order.
  • -1 if array is empty, or properly sorted.

Check for infinite values

Csize_t Array_CheckInf_flt32 (const flt32_t array[], size_t size);
size_t Array_CheckInf_flt64 (const flt64_t array[], size_t size);
C++size_t Array::CheckInf (const flt32_t array[], size_t size);
size_t Array::CheckInf (const flt64_t array[], size_t size);

Description: Check array elements for infinite values.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Index of first element, which values is infinity with either sign.
  • -1 if none element of array has Inf value, or array size is 0.

Check for NaN values

Csize_t Array_CheckNaN_flt32 (const flt32_t array[], size_t size);
size_t Array_CheckNaN_flt64 (const flt64_t array[], size_t size);
C++size_t Array::CheckNaN (const flt32_t array[], size_t size);
size_t Array::CheckNaN (const flt64_t array[], size_t size);

Description: Check array elements for NaN values.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value:

  • Index of first element, which values is NaN with either sign.
  • -1 if none element of array has NaN value, or array size is 0.

Check for overlap

C
Unsigned integer types
bool Array_Overlap_uint8 (const uint8_t array1[], size_t size1, const uint8_t array2[], size_t size2);
bool Array_Overlap_uint16 (const uint16_t array1[], size_t size1, const uint16_t array2[], size_t size2);
bool Array_Overlap_uint32 (const uint32_t array1[], size_t size1, const uint32_t array2[], size_t size2);
bool Array_Overlap_uint64 (const uint64_t array1[], size_t size1, const uint64_t array2[], size_t size2);

Signed integer types
bool Array_Overlap_sint8 (const sint8_t array1[], size_t size1, const sint8_t array2[], size_t size2);
bool Array_Overlap_sint16 (const sint16_t array1[], size_t size1, const sint16_t array2[], size_t size2);
bool Array_Overlap_sint32 (const sint32_t array1[], size_t size1, const sint32_t array2[], size_t size2);
bool Array_Overlap_sint64 (const sint64_t array1[], size_t size1, const sint64_t array2[], size_t size2);

Floating-point types
bool Array_Overlap_flt32 (const flt32_t array1[], size_t size1, const flt32_t array2[], size_t size2);
bool Array_Overlap_flt64 (const flt64_t array1[], size_t size1, const flt64_t array2[], size_t size2);

Other types
bool Array_Overlap_size (const size_t array1[], size_t size1, const size_t array2[], size_t size2);
bool Array_Overlap (const void *array1, size_t size1, const void *array2, size_t size2);
C++
Unsigned integer types
bool Array::Overlap (const uint8_t array1[], size_t size1, const uint8_t array2[], size_t size2);
bool Array::Overlap (const uint16_t array1[], size_t size1, const uint16_t array2[], size_t size2);
bool Array::Overlap (const uint32_t array1[], size_t size1, const uint32_t array2[], size_t size2);
bool Array::Overlap (const uint64_t array1[], size_t size1, const uint64_t array2[], size_t size2);

Signed integer types
bool Array::Overlap (const sint8_t array1[], size_t size1, const sint8_t array2[], size_t size2);
bool Array::Overlap (const sint16_t array1[], size_t size1, const sint16_t array2[], size_t size2);
bool Array::Overlap (const sint32_t array1[], size_t size1, const sint32_t array2[], size_t size2);
bool Array::Overlap (const sint64_t array1[], size_t size1, const sint64_t array2[], size_t size2);

Floating-point types
bool Array::Overlap (const flt32_t array1[], size_t size1, const flt32_t array2[], size_t size2);
bool Array::Overlap (const flt64_t array1[], size_t size1, const flt64_t array2[], size_t size2);

Other types
bool Array::Overlap (const size_t array1[], size_t size1, const size_t array2[], size_t size2);
bool Array::Overlap (const void *array1, size_t size1, const void *array2, size_t size2);

Description: Check arrays for overlap.

Parameters:

  • array1 - pointer to first array
  • size1 - size of first array (count of elements)
  • array2 - pointer to second array
  • size2 - size of second array (count of elements)

Return value:

  • TRUE (1) if arrays overlap each other.
  • FALSE (0) if they do not overlap each other.

Array hashing

These functions compute hash sum for all elements in the array and return 32-bit and 64-bit hash value. The hash functions (based on golden ratio) are very smooth and can generate very good uniform distribution, even for tiny range of keys. These functions are not designed for data verification (can generate many collisions), but for hash tables, where uniform distribution can significantly improve hash table balancing.

32-bit hash functions

C
Unsigned integer types
uint32_t Array_Hash32_uint8 (const uint8_t array[], size_t size);
uint32_t Array_Hash32_uint16 (const uint16_t array[], size_t size);
uint32_t Array_Hash32_uint32 (const uint32_t array[], size_t size);
uint32_t Array_Hash32_uint64 (const uint64_t array[], size_t size);

Signed integer types
uint32_t Array_Hash32_sint8 (const sint8_t array[], size_t size);
uint32_t Array_Hash32_sint16 (const sint16_t array[], size_t size);
uint32_t Array_Hash32_sint32 (const sint32_t array[], size_t size);
uint32_t Array_Hash32_sint64 (const sint64_t array[], size_t size);

Floating-point types
uint32_t Array_Hash32_flt32 (const flt32_t array[], size_t size);
uint32_t Array_Hash32_flt64 (const flt64_t array[], size_t size);

Other types
uint32_t Array_Hash32_size (const size_t array[], size_t size);
uint32_t Array_Hash32 (const void *array, size_t size);
C++
Unsigned integer types
uint32_t Array::Hash32 (const uint8_t array[], size_t size);
uint32_t Array::Hash32 (const uint16_t array[], size_t size);
uint32_t Array::Hash32 (const uint32_t array[], size_t size);
uint32_t Array::Hash32 (const uint64_t array[], size_t size);

Signed integer types
uint32_t Array::Hash32 (const sint8_t array[], size_t size);
uint32_t Array::Hash32 (const sint16_t array[], size_t size);
uint32_t Array::Hash32 (const sint32_t array[], size_t size);
uint32_t Array::Hash32 (const sint64_t array[], size_t size);

Floating-point types
uint32_t Array::Hash32 (const flt32_t array[], size_t size);
uint32_t Array::Hash32 (const flt64_t array[], size_t size);

Other types
uint32_t Array::Hash32 (const size_t array[], size_t size);
uint32_t Array::Hash32 (const void *array, size_t size);

Description: Compute 32-bit hash value for the array, using smooth hash function, based on golden ratio.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: 32-bit hash value.

64-bit hash functions

C
Unsigned integer types
uint64_t Array_Hash64_uint8 (const uint8_t array[], size_t size);
uint64_t Array_Hash64_uint16 (const uint16_t array[], size_t size);
uint64_t Array_Hash64_uint32 (const uint32_t array[], size_t size);
uint64_t Array_Hash64_uint64 (const uint64_t array[], size_t size);

Signed integer types
uint64_t Array_Hash64_sint8 (const sint8_t array[], size_t size);
uint64_t Array_Hash64_sint16 (const sint16_t array[], size_t size);
uint64_t Array_Hash64_sint32 (const sint32_t array[], size_t size);
uint64_t Array_Hash64_sint64 (const sint64_t array[], size_t size);

Floating-point types
uint64_t Array_Hash64_flt32 (const flt32_t array[], size_t size);
uint64_t Array_Hash64_flt64 (const flt64_t array[], size_t size);

Other types
uint64_t Array_Hash64_size (const size_t array[], size_t size);
uint64_t Array_Hash64 (const void *array, size_t size);
C++
Unsigned integer types
uint64_t Array::Hash64 (const uint8_t array[], size_t size);
uint64_t Array::Hash64 (const uint16_t array[], size_t size);
uint64_t Array::Hash64 (const uint32_t array[], size_t size);
uint64_t Array::Hash64 (const uint64_t array[], size_t size);

Signed integer types
uint64_t Array::Hash64 (const sint8_t array[], size_t size);
uint64_t Array::Hash64 (const sint16_t array[], size_t size);
uint64_t Array::Hash64 (const sint32_t array[], size_t size);
uint64_t Array::Hash64 (const sint64_t array[], size_t size);

Floating-point types
uint64_t Array::Hash64 (const flt32_t array[], size_t size);
uint64_t Array::Hash64 (const flt64_t array[], size_t size);

Other types
uint64_t Array::Hash64 (const size_t array[], size_t size);
uint64_t Array::Hash64 (const void *array, size_t size);

Description: Compute 64-bit hash value for the array, using smooth hash function, based on golden ratio.

Parameters:

  • array - pointer to array
  • size - size of array (count of elements)

Return value: 64-bit hash value.

Copyright 2012-2018 Jack Black. All rights reserved.