-
Notifications
You must be signed in to change notification settings - Fork 5
/
generate_mask.py
53 lines (40 loc) · 1.16 KB
/
generate_mask.py
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
import sys
def generate_1():
for i in range (0, 128):
for j in range (0, i/8):
sys.stdout.write("0xff, ")
if (i%8 < 4):
sys.stdout.write("0x0")
else:
sys.stdout.write("0x")
lastbyte = 0
for j in range (0, i%4):
lastbyte = (lastbyte << 1) + 1
sys.stdout.write(str(lastbyte) )
if (i%8 >= 4):
sys.stdout.write("f, ")
else:
sys.stdout.write(", ")
for j in range (i/8 + 1, 16):
sys.stdout.write("0x00, ")
print ""
def generate_11():
for i in range (0, 64):
for j in range (0, i/4):
sys.stdout.write("0xff, ")
if (i%4 < 2):
sys.stdout.write("0x0")
else:
sys.stdout.write("0x")
lastbyte = 0
for j in range (0, i%2):
lastbyte = (lastbyte << 2) + 3
sys.stdout.write(str(lastbyte) )
if (i%4 >= 2):
sys.stdout.write("f, ")
else:
sys.stdout.write(", ")
for j in range (i/4 + 1, 16):
sys.stdout.write("0x00, ")
print ""
generate_11()