File indexing completed on 2024-04-06 12:21:00
0001 from __future__ import print_function
0002
0003
0004
0005 entries = []
0006 for a in [1,0]:
0007 for b in [1,0]:
0008 for c in [1,0]:
0009 for d in [1,0]:
0010 for e in [1,0]:
0011 for f in [1,0]:
0012 entry = (a,b,c,d,e,f)
0013 entries.append(entry)
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 results = []
0029 for entry in entries:
0030 (a,b,c,d,e,f) = entry
0031
0032
0033 if a and b and c and d and e and f:
0034 vmask = (1,1,1,1)
0035
0036
0037 elif a and b and d:
0038 vmask = (1,1,1,0)
0039
0040
0041 elif a and f and e:
0042 vmask = (1,1,0,1)
0043
0044
0045 elif d and c and e:
0046 vmask = (1,0,1,1)
0047
0048
0049 elif b and c and f:
0050 vmask = (0,1,1,1)
0051
0052
0053 elif a:
0054 vmask = (1,1,0,0)
0055
0056
0057 elif d:
0058 vmask = (1,0,1,0)
0059
0060
0061 elif e:
0062 vmask = (1,0,0,1)
0063
0064
0065 elif b:
0066 vmask = (0,1,1,0)
0067
0068
0069 elif f:
0070 vmask = (0,1,0,1)
0071
0072
0073 elif c:
0074 vmask = (0,0,1,1)
0075
0076
0077 else:
0078 vmask = (0,0,0,0)
0079
0080 results.append(vmask)
0081
0082
0083
0084
0085 for result in results:
0086 (w,x,y,z) = result
0087 print("%i%i%i%i" % (z,y,x,w))
0088
0089
0090 generate_cpp_array = False
0091 if generate_cpp_array:
0092 linebreak = "\n "
0093 sep = ", "
0094 s = "static const int trk_bld[64] = {"
0095 s += linebreak
0096 i = 0
0097 for result in results:
0098 (w,x,y,z) = result
0099 s += "0b%i%i%i%i" % (z,y,x,w)
0100 if i != 63: s += sep
0101 if i%8 == 7 and i != 63: s += linebreak
0102 i += 1
0103 s += "\n};"
0104 print(s)