From 7e3d7f47828a4edff7842a0561b1954abf141033 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 14 Mar 2024 23:36:44 +0000 Subject: [PATCH] Auto-generated commit --- base/assert/uint32-is-pow2/README.md | 92 ++++++++++ .../benchmark/benchmark.native.js | 62 +++++++ .../benchmark/c/native/Makefile | 146 +++++++++++++++ .../benchmark/c/native/benchmark.c | 138 ++++++++++++++ base/assert/uint32-is-pow2/binding.gyp | 170 ++++++++++++++++++ .../assert/uint32-is-pow2/examples/c/Makefile | 146 +++++++++++++++ .../uint32-is-pow2/examples/c/example.c | 33 ++++ base/assert/uint32-is-pow2/include.gypi | 53 ++++++ .../stdlib/math/base/assert/uint32_is_pow2.h | 41 +++++ base/assert/uint32-is-pow2/lib/native.js | 55 ++++++ base/assert/uint32-is-pow2/manifest.json | 38 ++++ base/assert/uint32-is-pow2/src/Makefile | 70 ++++++++ base/assert/uint32-is-pow2/src/addon.c | 90 ++++++++++ base/assert/uint32-is-pow2/src/main.c | 38 ++++ .../assert/uint32-is-pow2/test/test.native.js | 63 +++++++ 15 files changed, 1235 insertions(+) create mode 100644 base/assert/uint32-is-pow2/benchmark/benchmark.native.js create mode 100644 base/assert/uint32-is-pow2/benchmark/c/native/Makefile create mode 100644 base/assert/uint32-is-pow2/benchmark/c/native/benchmark.c create mode 100644 base/assert/uint32-is-pow2/binding.gyp create mode 100644 base/assert/uint32-is-pow2/examples/c/Makefile create mode 100644 base/assert/uint32-is-pow2/examples/c/example.c create mode 100644 base/assert/uint32-is-pow2/include.gypi create mode 100644 base/assert/uint32-is-pow2/include/stdlib/math/base/assert/uint32_is_pow2.h create mode 100644 base/assert/uint32-is-pow2/lib/native.js create mode 100644 base/assert/uint32-is-pow2/manifest.json create mode 100644 base/assert/uint32-is-pow2/src/Makefile create mode 100644 base/assert/uint32-is-pow2/src/addon.c create mode 100644 base/assert/uint32-is-pow2/src/main.c create mode 100644 base/assert/uint32-is-pow2/test/test.native.js diff --git a/base/assert/uint32-is-pow2/README.md b/base/assert/uint32-is-pow2/README.md index 1fe10a660..485c1fd32 100644 --- a/base/assert/uint32-is-pow2/README.md +++ b/base/assert/uint32-is-pow2/README.md @@ -72,6 +72,98 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/assert/uint32_is_pow2.h" +``` + +#### stdlib_base_uint32_is_pow2( x ) + +Tests whether an unsigned integer is a power of 2. + +```c +#include + +bool out = stdlib_base_uint32_is_pow2( 5 ); +// returns false + +out = stdlib_base_uint32_is_pow2( 2 ); +// returns true +``` + +The function accepts the following arguments: + +- **x**: `[in] uint32_t` input value. + +```c +bool stdlib_base_uint32_is_pow2( const uint32_t x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/assert/uint32_is_pow2.h" +#include +#include +#include + +int main( void ) { + const uint32_t x[] = { 0, 1, 2, 3, 4, 5, 8, 10, 16, 1024 }; + bool b; + int i; + + for ( i = 0; i < 9; i++ ) { + b = stdlib_base_uint32_is_pow2( x[ i ] ); + printf( "Value: %u. is a power of 2? %s.\n", x[ i ], ( b ) ? "True" : "False" ); + } +} +``` + +
s + + + +
+ + +