Monado OpenXR Runtime
u_bitwise.c File Reference

Functions for manipulating tightly packed data as bits. More...

#include "util/u_bitwise.h"
#include <stdio.h>
#include <limits.h>
Include dependency graph for u_bitwise.c:

Macros

#define INCOMING_INT_WIDTH   (13)
 
#define ADJUSTMENT   ((sizeof(i) * CHAR_BIT) - INCOMING_INT_WIDTH)
 

Functions

int get_bit (const unsigned char *b, int num)
 
int get_bits (const unsigned char *b, int start, int num)
 
int sign_extend_13 (uint32_t i)
 Interpret the least-significant 13 bits as a signed 13-bit integer, and cast it to a signed int for normal usage. More...
 

Detailed Description

Functions for manipulating tightly packed data as bits.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m
Pete Black pete..nosp@m.blac.nosp@m.k@col.nosp@m.labo.nosp@m.ra.co.nosp@m.m

Function Documentation

◆ sign_extend_13()

int sign_extend_13 ( uint32_t  i)

Interpret the least-significant 13 bits as a signed 13-bit integer, and cast it to a signed int for normal usage.