Mistake on this page?
Report an issue in GitHub or email us
Macros | Typedefs | Enumerations | Functions
ll_math.h File Reference

Link Layer math utilities. More...

#include "wsf_types.h"

Go to the source code of this file.

Macros

#define LL_MATH_DIV_10E3(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(536871)) >> 29))
 Binary divide with 1,000 divisor (n[max]=7,999). More...
 
#define LL_MATH_DIV_10E6(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(4295)) >> 32))
 Binary divide with 1,000,000 divisor (n[max]=0xFFFFFFFF). More...
 
#define LL_MATH_DIV_10(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(419431)) >> 22))
 Binary divide with 10 divisor (n[max]=0xFFFFFFFF). More...
 
#define LL_MATH_DIV_27(n)    (((n) * UINT32_C(77673)) >> 21)
 Binary divide with 27 divisor (n[max]=55,295). More...
 
#define LL_MATH_DIV_37(n)    (((n) * UINT32_C(56680)) >> 21)
 Binary divide with 37 divisor (n[max]=75,776). More...
 
#define LL_MATH_MOD_37(n)    ((n) - (LL_MATH_DIV_37(n) * 37))
 Binary modulo 37. More...
 
#define LL_MATH_DIV_1250(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 31))
 Binary divide with 1250 divisor (n[max]=0xFFFFFFFF). More...
 
#define LL_MATH_DIV_625(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 30))
 Binary divide with 625 divisor (n[max]=0xFFFFFFFF). More...
 
#define LL_MATH_DIV_30(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(286331154)) >> 33))
 Binary divide with 30 divisor (n[max]=0xFFFFFFFF). More...
 
#define LL_MATH_DIV_300(n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(14660155038)) >> 42))
 Binary divide with 300 divisor (n[max]=0x3FFFFFFF). More...
 

Typedefs

typedef void(* LlMathEccServiceCback_t) (uint8_t op)
 ECC service callback. More...
 

Enumerations

Functions

uint32_t LlMathRandNum (void)
 Generate random number. More...
 
uint8_t LlMathGetNumBitsSet (uint64_t num)
 Return the number of bits which are set. More...
 
uint32_t LlMathDivideUint32 (uint32_t nu32, uint32_t de32)
 Return result of a division. More...
 
uint32_t LlMathDivideUint32RoundUp (uint32_t nu32, uint32_t de32)
 Return result of a division, rounding up. More...
 

Detailed Description

Link Layer math utilities.

Copyright (c) 2013-2019 Arm Ltd. All Rights Reserved.

Copyright (c) 2019 Packetcraft, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file ll_math.h.

Macro Definition Documentation

#define LL_MATH_DIV_10 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(419431)) >> 22))

Binary divide with 10 divisor (n[max]=0xFFFFFFFF).

Definition at line 44 of file ll_math.h.

#define LL_MATH_DIV_10E3 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(536871)) >> 29))

Binary divide with 1,000 divisor (n[max]=7,999).

Definition at line 38 of file ll_math.h.

#define LL_MATH_DIV_10E6 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(4295)) >> 32))

Binary divide with 1,000,000 divisor (n[max]=0xFFFFFFFF).

Definition at line 41 of file ll_math.h.

#define LL_MATH_DIV_1250 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 31))

Binary divide with 1250 divisor (n[max]=0xFFFFFFFF).

Definition at line 56 of file ll_math.h.

#define LL_MATH_DIV_27 (   n)    (((n) * UINT32_C(77673)) >> 21)

Binary divide with 27 divisor (n[max]=55,295).

Definition at line 47 of file ll_math.h.

#define LL_MATH_DIV_30 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(286331154)) >> 33))

Binary divide with 30 divisor (n[max]=0xFFFFFFFF).

Definition at line 62 of file ll_math.h.

#define LL_MATH_DIV_300 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(14660155038)) >> 42))

Binary divide with 300 divisor (n[max]=0x3FFFFFFF).

Definition at line 65 of file ll_math.h.

#define LL_MATH_DIV_37 (   n)    (((n) * UINT32_C(56680)) >> 21)

Binary divide with 37 divisor (n[max]=75,776).

Definition at line 50 of file ll_math.h.

#define LL_MATH_DIV_625 (   n)    ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 30))

Binary divide with 625 divisor (n[max]=0xFFFFFFFF).

Definition at line 59 of file ll_math.h.

#define LL_MATH_MOD_37 (   n)    ((n) - (LL_MATH_DIV_37(n) * 37))

Binary modulo 37.

Definition at line 53 of file ll_math.h.

Typedef Documentation

typedef void(* LlMathEccServiceCback_t) (uint8_t op)

ECC service callback.

Definition at line 72 of file ll_math.h.

Enumeration Type Documentation

anonymous enum

ECC operations.

Enumerator
LL_MATH_ECC_OP_GENERATE_P256_KEY_PAIR 

Generate P-256 key pair.

LL_MATH_ECC_OP_GENERATE_DH_KEY 

Generate Diffie-Hellman key.

Definition at line 75 of file ll_math.h.

Function Documentation

uint32_t LlMathDivideUint32 ( uint32_t  nu32,
uint32_t  de32 
)

Return result of a division.

Parameters
nu32Numerator of size 32 bits.
de32Denominator of size 32 bits.
Returns
Result of a division.
uint32_t LlMathDivideUint32RoundUp ( uint32_t  nu32,
uint32_t  de32 
)

Return result of a division, rounding up.

Parameters
nu32Numerator of size 32 bits.
de32Denominator of size 32 bits.
Returns
Result of a division.
uint8_t LlMathGetNumBitsSet ( uint64_t  num)

Return the number of bits which are set.

Parameters
numInput parameter.
Returns
Number of bits which are set.
uint32_t LlMathRandNum ( void  )

Generate random number.

Returns
32-bit random number.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.