2020-03-05 11:41:06 +00:00
|
|
|
// Copyright 2019-2020, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Functions for manipulating tightly packed data as bits.
|
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @author Pete Black <pete.black@collabora.com>
|
|
|
|
* @ingroup aux_util
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-06 14:29:37 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2020-03-05 11:41:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int
|
2020-08-06 14:29:37 +00:00
|
|
|
get_bit(const unsigned char *b, int num);
|
2020-03-05 11:41:06 +00:00
|
|
|
|
|
|
|
int
|
2020-08-06 14:29:37 +00:00
|
|
|
get_bits(const unsigned char *b, int start, int num);
|
2020-03-05 11:41:06 +00:00
|
|
|
|
2020-08-06 14:29:37 +00:00
|
|
|
/*!
|
|
|
|
* Interpret the least-significant 13 bits as a signed 13-bit integer, and cast
|
|
|
|
* it to a signed int for normal usage.
|
|
|
|
*/
|
2020-03-05 11:41:06 +00:00
|
|
|
int
|
2020-08-06 14:29:37 +00:00
|
|
|
sign_extend_13(uint32_t i);
|
2020-03-05 11:41:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|