-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbits_utils.h
69 lines (53 loc) · 1.23 KB
/
bits_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef AE_BITS_UTILS_H
#define AE_BITS_UTILS_H
#include <iostream>
#include "AELogger.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>
#include <math.h>
namespace AE
{
typedef unsigned int Uint;
typedef unsigned char Uchar;
typedef unsigned short Ushort;
typedef enum ENDIANESS
{
Little_endian,
Big_endian,
Middle_endian
} ENDIANESS;
typedef enum ORDRE_BITS
{
Big_head,
Little_head
} ORDRE_BITS;
union TestEndian
{
unsigned long total;
struct
{
unsigned char octet1;
unsigned char octet2;
unsigned char octet3;
unsigned char octet4;
} octets;
};
static ENDIANESS BitOrder;
static ENDIANESS ByteOrder;
ENDIANESS bit_order();
ENDIANESS byte_order();
#define BIT_ORDER BitOrder
void PrintBinary(int x, int d);
void initBitsUtils();
Uchar BitReverseUchar(const Uchar in);
int ByteReverseInt(const int in);
int BitReverseInt(const int in);
int bin_to_dec(char *binaire, int taille);
int puissance(int nombre, int nombre_de_fois);
Uchar extract_bits_from_byte(Uchar octet, Uchar pos, Uchar nb_bits);
int extract_bits(Uchar *buffer, Uint pos, Uchar nb_bits);
}
#endif