-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbit.hpp
61 lines (47 loc) · 949 Bytes
/
bit.hpp
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
#pragma once
#include "doot.hpp"
#include "arr.hpp"
#include <intrin.h>
/*
smol endian
requires SSE2
*/
namespace doot{
typedef __m256i xmm;
//making this a specialization of arr would be too constraining and misappropriate
//presumes the first bit is i8 aligned
struct bitptr{
arr<xmm> range;
sizt b;
//relative to beginning
inline void seekabs(sizt p){
ass(p>=0 && p<range.size()*8);
b= p;
}
//relative to current position
inline void seekadd(sizt d){
seekabs(b+d);
}
bool get();
void set(bool s);
};
inline void bitmemcpy(bitptr dst, bitptr src){
}
struct bitpacker{
arr<u8> data;
bitptr mark;
bitpacker(arr<u8> data_){
data= data_;
mark= {data,0};
}
inline void push(void* src, sizt size){
bitmemcpy(mark, mark, );
mark.seekadd(size);
}
inline void pull(void* dst,sizt size){
//TODO
mark.seekadd(size);
}
};
//compression functions
}