added bw_buf_add
This commit is contained in:
parent
6fe46ef56b
commit
1843233c96
@ -20,13 +20,18 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* module_type {{{ utility }}}
|
* module_type {{{ utility }}}
|
||||||
* version {{{ 0.3.0 }}}
|
* version {{{ 0.4.0 }}}
|
||||||
* requires {{{ bw_config bw_common }}}
|
* requires {{{ bw_config bw_common }}}
|
||||||
* description {{{
|
* description {{{
|
||||||
* Common operations on buffers.
|
* Common operations on buffers.
|
||||||
* }}}
|
* }}}
|
||||||
* changelog {{{
|
* changelog {{{
|
||||||
* <ul>
|
* <ul>
|
||||||
|
* <li>Version <strong>0.4.0</strong>:
|
||||||
|
* <ul>
|
||||||
|
* <li>Added `bw_buf_add()`.</li>
|
||||||
|
* </ul>
|
||||||
|
* </li>
|
||||||
* <li>Version <strong>0.3.0</strong>:
|
* <li>Version <strong>0.3.0</strong>:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>First release.</li>
|
* <li>First release.</li>
|
||||||
@ -46,6 +51,13 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! api {{{
|
/*! api {{{
|
||||||
|
* #### bw_buf_add()
|
||||||
|
* ```>>> */
|
||||||
|
static inline void bw_buf_add(float *dest, const float *src, float k, int n_elems);
|
||||||
|
/*! <<<```
|
||||||
|
* Adds `k` to the first `n_elems` in `src` and stores the results in the
|
||||||
|
* first `n_elems` of `dest`.
|
||||||
|
*
|
||||||
* #### bw_buf_scale()
|
* #### bw_buf_scale()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
static inline void bw_buf_scale(float *dest, const float *src, float k, int n_elems);
|
static inline void bw_buf_scale(float *dest, const float *src, float k, int n_elems);
|
||||||
@ -73,6 +85,11 @@ static inline void bw_buf_mul(float *dest, const float *src1, const float *src2,
|
|||||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||||
* change at any time in future versions. Please, do not use it directly. */
|
* change at any time in future versions. Please, do not use it directly. */
|
||||||
|
|
||||||
|
static inline void bw_buf_add(float *dest, const float *src, float k, int n_elems) {
|
||||||
|
for (int i = 0; i < n_elems; i++)
|
||||||
|
dest[i] = k + src[i];
|
||||||
|
}
|
||||||
|
|
||||||
static inline void bw_buf_scale(float *dest, const float *src, float k, int n_elems) {
|
static inline void bw_buf_scale(float *dest, const float *src, float k, int n_elems) {
|
||||||
for (int i = 0; i < n_elems; i++)
|
for (int i = 0; i < n_elems; i++)
|
||||||
dest[i] = k * src[i];
|
dest[i] = k * src[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user