-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPadding.bt
42 lines (35 loc) · 837 Bytes
/
Padding.bt
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
// -*- mode: c;-*-
// no macro functions
#define CALIGN16 ColumnAlign(16)
#define CALIGN12 ColumnAlign(12)
#define CALIGN8 ColumnAlign(8)
#define CALIGN4 ColumnAlign(4)
typedef struct (uint64 place) {
local string thisName = "ColumnAlign";
SIBE;
local int64 size = place-(FTell() % 16);
if( size < 0 ){
size = 16 + size;
}
SIT;
ubyte zeroes[size];
AssertUBytesZero(
zeroes,
parentof(this).thisName + "->ColumnAlign"
);
SIEND;
} ColumnAlign;
typedef struct {
local string thisName = "NullEater";
SIBE;
local uint64 size = 0;
while( ReadUByte(FTell()+size) != 0 ){
size++;
}
SIT;
ubyte zeroes[size];
// If this test ever fails,
// call the cops.
AssertUBytesZero( zeroes, "NullEater" );
SIEND;
} NullEater;