spandsp 0.0.6

bit_operations.c File Reference
`#include <inttypes.h>`
`#include <stdlib.h>`
`#include <fcntl.h>`
`#include <string.h>`
`#include <assert.h>`
`#include <memory.h>`
`#include "spandsp/telephony.h"`
`#include "spandsp/bit_operations.h"`

## Functions
uint16_t | bit_reverse16 (uint16_t x)
| Bit reverse a 16 bit word.
uint32_t | bit_reverse32 (uint32_t x)
| Bit reverse a 32 bit word.
uint32_t | bit_reverse_4bytes (uint32_t x)
| Bit reverse each of the four bytes in a 32 bit word.
void | bit_reverse (uint8_t to[], const uint8_t from[], int len)
| Bit reverse each byte in a buffer.
int | one_bits32 (uint32_t x)
| Find the number of set bits in a 32 bit word.
uint32_t | make_mask32 (uint32_t x)
| Create a mask as wide as the number in a 32 bit word.
uint16_t | make_mask16 (uint16_t x)
| Create a mask as wide as the number in a 16 bit word.

## Function Documentation

## ◆ bit_reverse()

void bit_reverse | ( | uint8_t | to[],
|  | const uint8_t | from[],
|  | int | len )

Bit reverse each byte in a buffer.

Parameters

  to | The buffer to place the reversed data in.
  from | The buffer containing the data to be reversed.
  len | The length of the data in the buffer.

## ◆ bit_reverse16()

uint16_t bit_reverse16 | ( | uint16_t | data | ) |

Bit reverse a 16 bit word.

Parameters

  data | The word to be reversed.

Returns
  The bit reversed version of data.

## ◆ bit_reverse32()

uint32_t bit_reverse32 | ( | uint32_t | data | ) |

Bit reverse a 32 bit word.

Parameters

  data | The word to be reversed.

Returns
  The bit reversed version of data.

## ◆ bit_reverse_4bytes()

uint32_t bit_reverse_4bytes | ( | uint32_t | data | ) |

Bit reverse each of the four bytes in a 32 bit word.

Parameters

  data | The word to be reversed.

Returns
  The bit reversed version of data.

## ◆ make_mask16()

uint16_t make_mask16 | ( | uint16_t | x | ) |

Create a mask as wide as the number in a 16 bit word.

Parameters

  x | The word to be searched.

Returns
  The mask.

## ◆ make_mask32()

uint32_t make_mask32 | ( | uint32_t | x | ) |

Create a mask as wide as the number in a 32 bit word.

Parameters

  x | The word to be searched.

Returns
  The mask.

## ◆ one_bits32()

int one_bits32 | ( | uint32_t | x | ) |

Find the number of set bits in a 32 bit word.

Parameters

  x | The word to be searched.

Returns
  The number of set bits.