8.2. bits — Bitwise operations

Source code: src/collections/bits.h

Test code: tst/collections/bits/main.c


static uint32_t bits_insert_32(uint32_t dst, int position, int size, uint32_t src)

Insert given number of bits into another value at given position.

For example, bits_insert_32(0xffffffff, 4, 8, 0x12) would return 0xfffff12f.

The resulting value of the insertion.
  • dst -

    Value to insert into.

  • position -

    Bit position, counted from LSB, in dst where to insert src, 0-31.

  • size -

    Number of bits to insert. 0-31.

  • src -

    Value to insert into dst.