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... | |
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.
#define LL_MATH_DIV_10 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(419431)) >> 22)) |
#define LL_MATH_DIV_10E3 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(536871)) >> 29)) |
#define LL_MATH_DIV_10E6 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(4295)) >> 32)) |
#define LL_MATH_DIV_1250 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 31)) |
#define LL_MATH_DIV_27 | ( | n | ) | (((n) * UINT32_C(77673)) >> 21) |
#define LL_MATH_DIV_30 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(286331154)) >> 33)) |
#define LL_MATH_DIV_300 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(14660155038)) >> 42)) |
#define LL_MATH_DIV_37 | ( | n | ) | (((n) * UINT32_C(56680)) >> 21) |
#define LL_MATH_DIV_625 | ( | n | ) | ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 30)) |
#define LL_MATH_MOD_37 | ( | n | ) | ((n) - (LL_MATH_DIV_37(n) * 37)) |
typedef void(* LlMathEccServiceCback_t) (uint8_t op) |
anonymous enum |
uint32_t LlMathDivideUint32 | ( | uint32_t | nu32, |
uint32_t | de32 | ||
) |
Return result of a division.
nu32 | Numerator of size 32 bits. |
de32 | Denominator of size 32 bits. |
uint32_t LlMathDivideUint32RoundUp | ( | uint32_t | nu32, |
uint32_t | de32 | ||
) |
Return result of a division, rounding up.
nu32 | Numerator of size 32 bits. |
de32 | Denominator of size 32 bits. |
uint8_t LlMathGetNumBitsSet | ( | uint64_t | num | ) |
Return the number of bits which are set.
num | Input parameter. |
uint32_t LlMathRandNum | ( | void | ) |
Generate random number.