Utility functions for SpiNNaker.
More...
#include <stdint.h>
Go to the source code of this file.
|
static uint32_t | __hi (uint64_t x) |
| This function returns the most significant 32-bit word of a 64-bit unsigned integer.
|
|
static uint32_t | __lo (uint64_t x) |
| This function returns the least significant 32-bit word of a 64-bit unsigned integer.
|
|
static uint64_t | round64 (uint64_t x) |
| The function treats the 64-bit number as if it were a 32-bit integer and a 32-bit fraction, rounding the fractional part.
|
|
static uint64_t | scale64 (uint64_t x, uint32_t y) |
| The function scales the 64-bit number x , treating y as if it were an unsigned long fract, rounding the fractional part.
|
|
static uint32_t | scale32 (uint32_t x, uint32_t y) |
| The function scales the 32-bit number x , treating y as if it were an unsigned long fract, rounding the fractional part.
|
|
static uint32_t | log_next_power_of_2 (uint32_t v) |
| Returns the log of the next highest power of 2 of a value.
|
|
static uint32_t | ilog_2 (uint32_t v) |
| Returns the integer part of the log to base 2 of a number.
|
|
static uint32_t | next_power_of_2 (uint32_t v) |
| Returns the next highest power of 2 of a value.
|
|
static bool | is_power_of_2 (uint32_t v) |
| Returns True if the value is a power of 2.
|
|
Utility functions for SpiNNaker.
- Author
- Dave Lester (david.nosp@m..r.l.nosp@m.ester.nosp@m.@man.nosp@m.chest.nosp@m.er.a.nosp@m.c.uk)
- Copyright
- © Dave Lester and The University of Manchester, 2013. All rights reserved. SpiNNaker Project Advanced Processor Technologies Group School of Computer Science The University of Manchester Manchester M13 9PL, UK
- Date
- 12 December, 2013
◆ __hi()
static uint32_t __hi |
( |
uint64_t |
x | ) |
|
|
inlinestatic |
This function returns the most significant 32-bit word of a 64-bit unsigned integer.
- Parameters
-
- Returns
- The most significant 32-bits of x.
◆ __lo()
static uint32_t __lo |
( |
uint64_t |
x | ) |
|
|
inlinestatic |
This function returns the least significant 32-bit word of a 64-bit unsigned integer.
- Parameters
-
- Returns
- The least significant 32-bits of x.
◆ round64()
static uint64_t round64 |
( |
uint64_t |
x | ) |
|
|
inlinestatic |
The function treats the 64-bit number as if it were a 32-bit integer and a 32-bit fraction, rounding the fractional part.
- Parameters
-
- Returns
- The rounded result.
◆ scale64()
static uint64_t scale64 |
( |
uint64_t |
x, |
|
|
uint32_t |
y |
|
) |
| |
|
inlinestatic |
The function scales the 64-bit number x
, treating y
as if it were an unsigned long fract, rounding the fractional part.
- Parameters
-
[in] | x | A 64-bit unsigned integer. |
[in] | y | A 32-bit unsigned integer treated as if it is an unsigned long fract. |
- Returns
- The rounded result.
◆ scale32()
static uint32_t scale32 |
( |
uint32_t |
x, |
|
|
uint32_t |
y |
|
) |
| |
|
inlinestatic |
The function scales the 32-bit number x
, treating y
as if it were an unsigned long fract, rounding the fractional part.
- Parameters
-
[in] | x | A 32-bit unsigned integer. |
[in] | y | A 32-bit unsigned integer treated as if it is an unsigned long fract. |
- Returns
- The rounded result.
◆ log_next_power_of_2()
static uint32_t log_next_power_of_2 |
( |
uint32_t |
v | ) |
|
|
inlinestatic |
Returns the log of the next highest power of 2 of a value.
- Parameters
-
[in] | v | A 32-bit unsigned integer |
- Returns
- The log of the next highest power of 2
◆ ilog_2()
static uint32_t ilog_2 |
( |
uint32_t |
v | ) |
|
|
inlinestatic |
Returns the integer part of the log to base 2 of a number.
- Parameters
-
[in] | v | A 32-bit unsigned integer |
- Returns
- The log to the base 2
◆ next_power_of_2()
static uint32_t next_power_of_2 |
( |
uint32_t |
v | ) |
|
|
inlinestatic |
Returns the next highest power of 2 of a value.
- Parameters
-
[in] | v | A 32-bit unsigned integer |
- Returns
- The next highest power of 2
◆ is_power_of_2()
static bool is_power_of_2 |
( |
uint32_t |
v | ) |
|
|
inlinestatic |
Returns True if the value is a power of 2.
- Parameters
-
[in] | v | A 32-bit unsigned integer |
- Returns
- True if the value is a power of 2, False if not