From 1715663602feb424366535f140c32b5ce6496d03 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Mar 2024 21:40:46 +0000 Subject: [PATCH] Auto-generated commit --- base/special/fast/uint32-sqrt/README.md | 91 ++++++++++ .../uint32-sqrt/benchmark/benchmark.native.js | 58 ++++++ .../uint32-sqrt/benchmark/c/native/Makefile | 146 +++++++++++++++ .../benchmark/c/native/benchmark.c | 137 ++++++++++++++ base/special/fast/uint32-sqrt/binding.gyp | 170 ++++++++++++++++++ .../fast/uint32-sqrt/examples/c/Makefile | 146 +++++++++++++++ .../fast/uint32-sqrt/examples/c/example.c | 32 ++++ base/special/fast/uint32-sqrt/include.gypi | 53 ++++++ .../math/base/special/fast/uint32_sqrt.h | 43 +++++ base/special/fast/uint32-sqrt/lib/native.js | 58 ++++++ base/special/fast/uint32-sqrt/manifest.json | 68 +++++++ base/special/fast/uint32-sqrt/src/Makefile | 70 ++++++++ base/special/fast/uint32-sqrt/src/addon.c | 90 ++++++++++ base/special/fast/uint32-sqrt/src/main.c | 59 ++++++ .../fast/uint32-sqrt/test/test.native.js | 73 ++++++++ 15 files changed, 1294 insertions(+) create mode 100644 base/special/fast/uint32-sqrt/benchmark/benchmark.native.js create mode 100644 base/special/fast/uint32-sqrt/benchmark/c/native/Makefile create mode 100644 base/special/fast/uint32-sqrt/benchmark/c/native/benchmark.c create mode 100644 base/special/fast/uint32-sqrt/binding.gyp create mode 100644 base/special/fast/uint32-sqrt/examples/c/Makefile create mode 100644 base/special/fast/uint32-sqrt/examples/c/example.c create mode 100644 base/special/fast/uint32-sqrt/include.gypi create mode 100644 base/special/fast/uint32-sqrt/include/stdlib/math/base/special/fast/uint32_sqrt.h create mode 100644 base/special/fast/uint32-sqrt/lib/native.js create mode 100644 base/special/fast/uint32-sqrt/manifest.json create mode 100644 base/special/fast/uint32-sqrt/src/Makefile create mode 100644 base/special/fast/uint32-sqrt/src/addon.c create mode 100644 base/special/fast/uint32-sqrt/src/main.c create mode 100644 base/special/fast/uint32-sqrt/test/test.native.js diff --git a/base/special/fast/uint32-sqrt/README.md b/base/special/fast/uint32-sqrt/README.md index ec23c6d6f..231bdc308 100644 --- a/base/special/fast/uint32-sqrt/README.md +++ b/base/special/fast/uint32-sqrt/README.md @@ -92,6 +92,97 @@ for ( i = 0; i < 101; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/fast/uint32_sqrt.h" +``` + +#### stdlib_base_fast_uint32_sqrt( x ) + +Compute an integer [square root][square-root]. + +```c +#include + +uint32_t out = stdlib_base_fast_uint32_sqrt( 2 ); +// returns 1 + +out = stdlib_base_fast_uint32_sqrt( 8 ); +// returns 3 +``` + +The function accepts the following arguments: + +- **x**: `[in] uint32_t` input value. + +```c +uint32_t stdlib_base_fast_uint32_sqrt( const uint32_t x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/fast/uint32_sqrt.h" +#include +#include + +int main( void ) { + const uint32_t x[] = { 10, 17, 20, 22, 98 }; + + uint32_t y; + int i; + for ( i = 0; i < 5; i++ ) { + y = stdlib_base_fast_uint32_sqrt( x[ i ] ); + printf( "uint32_sqrt(%u) = %u\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +