3 public class buildprefix {
5 public static void main(String xstr[]) {
6 buildprefix bf=new buildprefix();
7 bf.foo(Integer.valueOf(xstr[0]));
14 public void foo(int maxbit) {
22 for(int count=0;count<max;count++) {
23 int numbits=bits(value);
24 int mask=mask(numbits);
25 if ((lastcount&mask)!=(count&mask))
26 value=increment(value);
35 System.out.println("lastindex="+lastindex+" lastvalue="+lastvalue);
36 System.out.print("int markmappingarray[]={");
37 for(int count=0;count<max;count++) {
39 System.out.print(", ");
42 System.out.println("");
43 System.out.print(" ");
46 System.out.print(x[count]);
48 System.out.println("};");
50 for(int count=0;count<max;count++) {
51 if (x[count]>=value) {
52 System.out.println(value+": "+count);
53 if (value==0&&!prefix)
60 System.out.print("int revmarkmappingarray[]={");
63 for(int count=0;count<max;count++) {
64 if (x[count]>=value) {
65 while(x[count]!=value) {
67 System.out.print(", ");
68 if ((printed%16)==0) {
69 System.out.println("");
70 System.out.print(" ");
73 System.out.print("0");
78 System.out.print(", ");
80 if ((printed%16)==0) {
81 System.out.println("");
82 System.out.print(" ");
85 System.out.print(count);
87 if (value==0&&!prefix)
93 System.out.println("};");
95 System.out.print("int revmarkmappingarray[]={");
98 for(int count=0;count<max;count++) {
99 if (x[count]>=value) {
100 while(x[count]!=value) {
102 System.out.print(", ");
103 if ((printed%16)==0) {
104 System.out.println("");
105 System.out.print(" ");
108 System.out.print("0x0");
113 System.out.print(", ");
115 if ((printed%16)==0) {
116 System.out.println("");
117 System.out.print(" ");
121 System.out.print("0x"+Long.toHexString(valcount<<(32-maxbits)));
123 if (value==0&&!prefix)
129 System.out.println("};");
133 return ((max-1)>>(maxbits-x))<<(maxbits-x);
147 int increment(int x) {