1636ce33bSDmitri Tikhonov/* Generate table for fast Huffman encoding */ 2636ce33bSDmitri Tikhonov 3636ce33bSDmitri Tikhonov#include <inttypes.h> 4636ce33bSDmitri Tikhonov#include <stdint.h> 5636ce33bSDmitri Tikhonov#include <stdio.h> 6636ce33bSDmitri Tikhonov#include <stdlib.h> 7636ce33bSDmitri Tikhonov 8636ce33bSDmitri Tikhonovstruct encode_el 9636ce33bSDmitri Tikhonov{ 10636ce33bSDmitri Tikhonov uint32_t code; 11636ce33bSDmitri Tikhonov int bits; 12636ce33bSDmitri Tikhonov}; 13636ce33bSDmitri Tikhonov 14636ce33bSDmitri Tikhonovstatic const struct encode_el encode_table[257] = 15636ce33bSDmitri Tikhonov{ 16636ce33bSDmitri Tikhonov { 0x1ff8, 13}, // ( 0) 17636ce33bSDmitri Tikhonov { 0x7fffd8, 23}, // ( 1) 18636ce33bSDmitri Tikhonov { 0xfffffe2, 28}, // ( 2) 19636ce33bSDmitri Tikhonov { 0xfffffe3, 28}, // ( 3) 20636ce33bSDmitri Tikhonov { 0xfffffe4, 28}, // ( 4) 21636ce33bSDmitri Tikhonov { 0xfffffe5, 28}, // ( 5) 22636ce33bSDmitri Tikhonov { 0xfffffe6, 28}, // ( 6) 23636ce33bSDmitri Tikhonov { 0xfffffe7, 28}, // ( 7) 24636ce33bSDmitri Tikhonov { 0xfffffe8, 28}, // ( 8) 25636ce33bSDmitri Tikhonov { 0xffffea, 24}, // ( 9) 26636ce33bSDmitri Tikhonov { 0x3ffffffc, 30}, // ( 10) 27636ce33bSDmitri Tikhonov { 0xfffffe9, 28}, // ( 11) 28636ce33bSDmitri Tikhonov { 0xfffffea, 28}, // ( 12) 29636ce33bSDmitri Tikhonov { 0x3ffffffd, 30}, // ( 13) 30636ce33bSDmitri Tikhonov { 0xfffffeb, 28}, // ( 14) 31636ce33bSDmitri Tikhonov { 0xfffffec, 28}, // ( 15) 32636ce33bSDmitri Tikhonov { 0xfffffed, 28}, // ( 16) 33636ce33bSDmitri Tikhonov { 0xfffffee, 28}, // ( 17) 34636ce33bSDmitri Tikhonov { 0xfffffef, 28}, // ( 18) 35636ce33bSDmitri Tikhonov { 0xffffff0, 28}, // ( 19) 36636ce33bSDmitri Tikhonov { 0xffffff1, 28}, // ( 20) 37636ce33bSDmitri Tikhonov { 0xffffff2, 28}, // ( 21) 38636ce33bSDmitri Tikhonov { 0x3ffffffe, 30}, // ( 22) 39636ce33bSDmitri Tikhonov { 0xffffff3, 28}, // ( 23) 40636ce33bSDmitri Tikhonov { 0xffffff4, 28}, // ( 24) 41636ce33bSDmitri Tikhonov { 0xffffff5, 28}, // ( 25) 42636ce33bSDmitri Tikhonov { 0xffffff6, 28}, // ( 26) 43636ce33bSDmitri Tikhonov { 0xffffff7, 28}, // ( 27) 44636ce33bSDmitri Tikhonov { 0xffffff8, 28}, // ( 28) 45636ce33bSDmitri Tikhonov { 0xffffff9, 28}, // ( 29) 46636ce33bSDmitri Tikhonov { 0xffffffa, 28}, // ( 30) 47636ce33bSDmitri Tikhonov { 0xffffffb, 28}, // ( 31) 48636ce33bSDmitri Tikhonov { 0x14, 6}, // ' ' ( 32) 49636ce33bSDmitri Tikhonov { 0x3f8, 10}, // '!' ( 33) 50636ce33bSDmitri Tikhonov { 0x3f9, 10}, // '"' ( 34) 51636ce33bSDmitri Tikhonov { 0xffa, 12}, // '#' ( 35) 52636ce33bSDmitri Tikhonov { 0x1ff9, 13}, // '$' ( 36) 53636ce33bSDmitri Tikhonov { 0x15, 6}, // '%' ( 37) 54636ce33bSDmitri Tikhonov { 0xf8, 8}, // '&' ( 38) 55636ce33bSDmitri Tikhonov { 0x7fa, 11}, // ''' ( 39) 56636ce33bSDmitri Tikhonov { 0x3fa, 10}, // '(' ( 40) 57636ce33bSDmitri Tikhonov { 0x3fb, 10}, // ')' ( 41) 58636ce33bSDmitri Tikhonov { 0xf9, 8}, // '*' ( 42) 59636ce33bSDmitri Tikhonov { 0x7fb, 11}, // '+' ( 43) 60636ce33bSDmitri Tikhonov { 0xfa, 8}, // ',' ( 44) 61636ce33bSDmitri Tikhonov { 0x16, 6}, // '-' ( 45) 62636ce33bSDmitri Tikhonov { 0x17, 6}, // '.' ( 46) 63636ce33bSDmitri Tikhonov { 0x18, 6}, // '/' ( 47) 64636ce33bSDmitri Tikhonov { 0x0, 5}, // '0' ( 48) 65636ce33bSDmitri Tikhonov { 0x1, 5}, // '1' ( 49) 66636ce33bSDmitri Tikhonov { 0x2, 5}, // '2' ( 50) 67636ce33bSDmitri Tikhonov { 0x19, 6}, // '3' ( 51) 68636ce33bSDmitri Tikhonov { 0x1a, 6}, // '4' ( 52) 69636ce33bSDmitri Tikhonov { 0x1b, 6}, // '5' ( 53) 70636ce33bSDmitri Tikhonov { 0x1c, 6}, // '6' ( 54) 71636ce33bSDmitri Tikhonov { 0x1d, 6}, // '7' ( 55) 72636ce33bSDmitri Tikhonov { 0x1e, 6}, // '8' ( 56) 73636ce33bSDmitri Tikhonov { 0x1f, 6}, // '9' ( 57) 74636ce33bSDmitri Tikhonov { 0x5c, 7}, // ':' ( 58) 75636ce33bSDmitri Tikhonov { 0xfb, 8}, // ';' ( 59) 76636ce33bSDmitri Tikhonov { 0x7ffc, 15}, // '<' ( 60) 77636ce33bSDmitri Tikhonov { 0x20, 6}, // '=' ( 61) 78636ce33bSDmitri Tikhonov { 0xffb, 12}, // '>' ( 62) 79636ce33bSDmitri Tikhonov { 0x3fc, 10}, // '?' ( 63) 80636ce33bSDmitri Tikhonov { 0x1ffa, 13}, // '@' ( 64) 81636ce33bSDmitri Tikhonov { 0x21, 6}, // 'A' ( 65) 82636ce33bSDmitri Tikhonov { 0x5d, 7}, // 'B' ( 66) 83636ce33bSDmitri Tikhonov { 0x5e, 7}, // 'C' ( 67) 84636ce33bSDmitri Tikhonov { 0x5f, 7}, // 'D' ( 68) 85636ce33bSDmitri Tikhonov { 0x60, 7}, // 'E' ( 69) 86636ce33bSDmitri Tikhonov { 0x61, 7}, // 'F' ( 70) 87636ce33bSDmitri Tikhonov { 0x62, 7}, // 'G' ( 71) 88636ce33bSDmitri Tikhonov { 0x63, 7}, // 'H' ( 72) 89636ce33bSDmitri Tikhonov { 0x64, 7}, // 'I' ( 73) 90636ce33bSDmitri Tikhonov { 0x65, 7}, // 'J' ( 74) 91636ce33bSDmitri Tikhonov { 0x66, 7}, // 'K' ( 75) 92636ce33bSDmitri Tikhonov { 0x67, 7}, // 'L' ( 76) 93636ce33bSDmitri Tikhonov { 0x68, 7}, // 'M' ( 77) 94636ce33bSDmitri Tikhonov { 0x69, 7}, // 'N' ( 78) 95636ce33bSDmitri Tikhonov { 0x6a, 7}, // 'O' ( 79) 96636ce33bSDmitri Tikhonov { 0x6b, 7}, // 'P' ( 80) 97636ce33bSDmitri Tikhonov { 0x6c, 7}, // 'Q' ( 81) 98636ce33bSDmitri Tikhonov { 0x6d, 7}, // 'R' ( 82) 99636ce33bSDmitri Tikhonov { 0x6e, 7}, // 'S' ( 83) 100636ce33bSDmitri Tikhonov { 0x6f, 7}, // 'T' ( 84) 101636ce33bSDmitri Tikhonov { 0x70, 7}, // 'U' ( 85) 102636ce33bSDmitri Tikhonov { 0x71, 7}, // 'V' ( 86) 103636ce33bSDmitri Tikhonov { 0x72, 7}, // 'W' ( 87) 104636ce33bSDmitri Tikhonov { 0xfc, 8}, // 'X' ( 88) 105636ce33bSDmitri Tikhonov { 0x73, 7}, // 'Y' ( 89) 106636ce33bSDmitri Tikhonov { 0xfd, 8}, // 'Z' ( 90) 107636ce33bSDmitri Tikhonov { 0x1ffb, 13}, // '[' ( 91) 108636ce33bSDmitri Tikhonov { 0x7fff0, 19}, // '\' ( 92) 109636ce33bSDmitri Tikhonov { 0x1ffc, 13}, // ']' ( 93) 110636ce33bSDmitri Tikhonov { 0x3ffc, 14}, // '^' ( 94) 111636ce33bSDmitri Tikhonov { 0x22, 6}, // '_' ( 95) 112636ce33bSDmitri Tikhonov { 0x7ffd, 15}, // '`' ( 96) 113636ce33bSDmitri Tikhonov { 0x3, 5}, // 'a' ( 97) 114636ce33bSDmitri Tikhonov { 0x23, 6}, // 'b' ( 98) 115636ce33bSDmitri Tikhonov { 0x4, 5}, // 'c' ( 99) 116636ce33bSDmitri Tikhonov { 0x24, 6}, // 'd' (100) 117636ce33bSDmitri Tikhonov { 0x5, 5}, // 'e' (101) 118636ce33bSDmitri Tikhonov { 0x25, 6}, // 'f' (102) 119636ce33bSDmitri Tikhonov { 0x26, 6}, // 'g' (103) 120636ce33bSDmitri Tikhonov { 0x27, 6}, // 'h' (104) 121636ce33bSDmitri Tikhonov { 0x6, 5}, // 'i' (105) 122636ce33bSDmitri Tikhonov { 0x74, 7}, // 'j' (106) 123636ce33bSDmitri Tikhonov { 0x75, 7}, // 'k' (107) 124636ce33bSDmitri Tikhonov { 0x28, 6}, // 'l' (108) 125636ce33bSDmitri Tikhonov { 0x29, 6}, // 'm' (109) 126636ce33bSDmitri Tikhonov { 0x2a, 6}, // 'n' (110) 127636ce33bSDmitri Tikhonov { 0x7, 5}, // 'o' (111) 128636ce33bSDmitri Tikhonov { 0x2b, 6}, // 'p' (112) 129636ce33bSDmitri Tikhonov { 0x76, 7}, // 'q' (113) 130636ce33bSDmitri Tikhonov { 0x2c, 6}, // 'r' (114) 131636ce33bSDmitri Tikhonov { 0x8, 5}, // 's' (115) 132636ce33bSDmitri Tikhonov { 0x9, 5}, // 't' (116) 133636ce33bSDmitri Tikhonov { 0x2d, 6}, // 'u' (117) 134636ce33bSDmitri Tikhonov { 0x77, 7}, // 'v' (118) 135636ce33bSDmitri Tikhonov { 0x78, 7}, // 'w' (119) 136636ce33bSDmitri Tikhonov { 0x79, 7}, // 'x' (120) 137636ce33bSDmitri Tikhonov { 0x7a, 7}, // 'y' (121) 138636ce33bSDmitri Tikhonov { 0x7b, 7}, // 'z' (122) 139636ce33bSDmitri Tikhonov { 0x7ffe, 15}, // '{' (123) 140636ce33bSDmitri Tikhonov { 0x7fc, 11}, // '|' (124) 141636ce33bSDmitri Tikhonov { 0x3ffd, 14}, // '}' (125) 142636ce33bSDmitri Tikhonov { 0x1ffd, 13}, // '~' (126) 143636ce33bSDmitri Tikhonov { 0xffffffc, 28}, // (127) 144636ce33bSDmitri Tikhonov { 0xfffe6, 20}, // (128) 145636ce33bSDmitri Tikhonov { 0x3fffd2, 22}, // (129) 146636ce33bSDmitri Tikhonov { 0xfffe7, 20}, // (130) 147636ce33bSDmitri Tikhonov { 0xfffe8, 20}, // (131) 148636ce33bSDmitri Tikhonov { 0x3fffd3, 22}, // (132) 149636ce33bSDmitri Tikhonov { 0x3fffd4, 22}, // (133) 150636ce33bSDmitri Tikhonov { 0x3fffd5, 22}, // (134) 151636ce33bSDmitri Tikhonov { 0x7fffd9, 23}, // (135) 152636ce33bSDmitri Tikhonov { 0x3fffd6, 22}, // (136) 153636ce33bSDmitri Tikhonov { 0x7fffda, 23}, // (137) 154636ce33bSDmitri Tikhonov { 0x7fffdb, 23}, // (138) 155636ce33bSDmitri Tikhonov { 0x7fffdc, 23}, // (139) 156636ce33bSDmitri Tikhonov { 0x7fffdd, 23}, // (140) 157636ce33bSDmitri Tikhonov { 0x7fffde, 23}, // (141) 158636ce33bSDmitri Tikhonov { 0xffffeb, 24}, // (142) 159636ce33bSDmitri Tikhonov { 0x7fffdf, 23}, // (143) 160636ce33bSDmitri Tikhonov { 0xffffec, 24}, // (144) 161636ce33bSDmitri Tikhonov { 0xffffed, 24}, // (145) 162636ce33bSDmitri Tikhonov { 0x3fffd7, 22}, // (146) 163636ce33bSDmitri Tikhonov { 0x7fffe0, 23}, // (147) 164636ce33bSDmitri Tikhonov { 0xffffee, 24}, // (148) 165636ce33bSDmitri Tikhonov { 0x7fffe1, 23}, // (149) 166636ce33bSDmitri Tikhonov { 0x7fffe2, 23}, // (150) 167636ce33bSDmitri Tikhonov { 0x7fffe3, 23}, // (151) 168636ce33bSDmitri Tikhonov { 0x7fffe4, 23}, // (152) 169636ce33bSDmitri Tikhonov { 0x1fffdc, 21}, // (153) 170636ce33bSDmitri Tikhonov { 0x3fffd8, 22}, // (154) 171636ce33bSDmitri Tikhonov { 0x7fffe5, 23}, // (155) 172636ce33bSDmitri Tikhonov { 0x3fffd9, 22}, // (156) 173636ce33bSDmitri Tikhonov { 0x7fffe6, 23}, // (157) 174636ce33bSDmitri Tikhonov { 0x7fffe7, 23}, // (158) 175636ce33bSDmitri Tikhonov { 0xffffef, 24}, // (159) 176636ce33bSDmitri Tikhonov { 0x3fffda, 22}, // (160) 177636ce33bSDmitri Tikhonov { 0x1fffdd, 21}, // (161) 178636ce33bSDmitri Tikhonov { 0xfffe9, 20}, // (162) 179636ce33bSDmitri Tikhonov { 0x3fffdb, 22}, // (163) 180636ce33bSDmitri Tikhonov { 0x3fffdc, 22}, // (164) 181636ce33bSDmitri Tikhonov { 0x7fffe8, 23}, // (165) 182636ce33bSDmitri Tikhonov { 0x7fffe9, 23}, // (166) 183636ce33bSDmitri Tikhonov { 0x1fffde, 21}, // (167) 184636ce33bSDmitri Tikhonov { 0x7fffea, 23}, // (168) 185636ce33bSDmitri Tikhonov { 0x3fffdd, 22}, // (169) 186636ce33bSDmitri Tikhonov { 0x3fffde, 22}, // (170) 187636ce33bSDmitri Tikhonov { 0xfffff0, 24}, // (171) 188636ce33bSDmitri Tikhonov { 0x1fffdf, 21}, // (172) 189636ce33bSDmitri Tikhonov { 0x3fffdf, 22}, // (173) 190636ce33bSDmitri Tikhonov { 0x7fffeb, 23}, // (174) 191636ce33bSDmitri Tikhonov { 0x7fffec, 23}, // (175) 192636ce33bSDmitri Tikhonov { 0x1fffe0, 21}, // (176) 193636ce33bSDmitri Tikhonov { 0x1fffe1, 21}, // (177) 194636ce33bSDmitri Tikhonov { 0x3fffe0, 22}, // (178) 195636ce33bSDmitri Tikhonov { 0x1fffe2, 21}, // (179) 196636ce33bSDmitri Tikhonov { 0x7fffed, 23}, // (180) 197636ce33bSDmitri Tikhonov { 0x3fffe1, 22}, // (181) 198636ce33bSDmitri Tikhonov { 0x7fffee, 23}, // (182) 199636ce33bSDmitri Tikhonov { 0x7fffef, 23}, // (183) 200636ce33bSDmitri Tikhonov { 0xfffea, 20}, // (184) 201636ce33bSDmitri Tikhonov { 0x3fffe2, 22}, // (185) 202636ce33bSDmitri Tikhonov { 0x3fffe3, 22}, // (186) 203636ce33bSDmitri Tikhonov { 0x3fffe4, 22}, // (187) 204636ce33bSDmitri Tikhonov { 0x7ffff0, 23}, // (188) 205636ce33bSDmitri Tikhonov { 0x3fffe5, 22}, // (189) 206636ce33bSDmitri Tikhonov { 0x3fffe6, 22}, // (190) 207636ce33bSDmitri Tikhonov { 0x7ffff1, 23}, // (191) 208636ce33bSDmitri Tikhonov { 0x3ffffe0, 26}, // (192) 209636ce33bSDmitri Tikhonov { 0x3ffffe1, 26}, // (193) 210636ce33bSDmitri Tikhonov { 0xfffeb, 20}, // (194) 211636ce33bSDmitri Tikhonov { 0x7fff1, 19}, // (195) 212636ce33bSDmitri Tikhonov { 0x3fffe7, 22}, // (196) 213636ce33bSDmitri Tikhonov { 0x7ffff2, 23}, // (197) 214636ce33bSDmitri Tikhonov { 0x3fffe8, 22}, // (198) 215636ce33bSDmitri Tikhonov { 0x1ffffec, 25}, // (199) 216636ce33bSDmitri Tikhonov { 0x3ffffe2, 26}, // (200) 217636ce33bSDmitri Tikhonov { 0x3ffffe3, 26}, // (201) 218636ce33bSDmitri Tikhonov { 0x3ffffe4, 26}, // (202) 219636ce33bSDmitri Tikhonov { 0x7ffffde, 27}, // (203) 220636ce33bSDmitri Tikhonov { 0x7ffffdf, 27}, // (204) 221636ce33bSDmitri Tikhonov { 0x3ffffe5, 26}, // (205) 222636ce33bSDmitri Tikhonov { 0xfffff1, 24}, // (206) 223636ce33bSDmitri Tikhonov { 0x1ffffed, 25}, // (207) 224636ce33bSDmitri Tikhonov { 0x7fff2, 19}, // (208) 225636ce33bSDmitri Tikhonov { 0x1fffe3, 21}, // (209) 226636ce33bSDmitri Tikhonov { 0x3ffffe6, 26}, // (210) 227636ce33bSDmitri Tikhonov { 0x7ffffe0, 27}, // (211) 228636ce33bSDmitri Tikhonov { 0x7ffffe1, 27}, // (212) 229636ce33bSDmitri Tikhonov { 0x3ffffe7, 26}, // (213) 230636ce33bSDmitri Tikhonov { 0x7ffffe2, 27}, // (214) 231636ce33bSDmitri Tikhonov { 0xfffff2, 24}, // (215) 232636ce33bSDmitri Tikhonov { 0x1fffe4, 21}, // (216) 233636ce33bSDmitri Tikhonov { 0x1fffe5, 21}, // (217) 234636ce33bSDmitri Tikhonov { 0x3ffffe8, 26}, // (218) 235636ce33bSDmitri Tikhonov { 0x3ffffe9, 26}, // (219) 236636ce33bSDmitri Tikhonov { 0xffffffd, 28}, // (220) 237636ce33bSDmitri Tikhonov { 0x7ffffe3, 27}, // (221) 238636ce33bSDmitri Tikhonov { 0x7ffffe4, 27}, // (222) 239636ce33bSDmitri Tikhonov { 0x7ffffe5, 27}, // (223) 240636ce33bSDmitri Tikhonov { 0xfffec, 20}, // (224) 241636ce33bSDmitri Tikhonov { 0xfffff3, 24}, // (225) 242636ce33bSDmitri Tikhonov { 0xfffed, 20}, // (226) 243636ce33bSDmitri Tikhonov { 0x1fffe6, 21}, // (227) 244636ce33bSDmitri Tikhonov { 0x3fffe9, 22}, // (228) 245636ce33bSDmitri Tikhonov { 0x1fffe7, 21}, // (229) 246636ce33bSDmitri Tikhonov { 0x1fffe8, 21}, // (230) 247636ce33bSDmitri Tikhonov { 0x7ffff3, 23}, // (231) 248636ce33bSDmitri Tikhonov { 0x3fffea, 22}, // (232) 249636ce33bSDmitri Tikhonov { 0x3fffeb, 22}, // (233) 250636ce33bSDmitri Tikhonov { 0x1ffffee, 25}, // (234) 251636ce33bSDmitri Tikhonov { 0x1ffffef, 25}, // (235) 252636ce33bSDmitri Tikhonov { 0xfffff4, 24}, // (236) 253636ce33bSDmitri Tikhonov { 0xfffff5, 24}, // (237) 254636ce33bSDmitri Tikhonov { 0x3ffffea, 26}, // (238) 255636ce33bSDmitri Tikhonov { 0x7ffff4, 23}, // (239) 256636ce33bSDmitri Tikhonov { 0x3ffffeb, 26}, // (240) 257636ce33bSDmitri Tikhonov { 0x7ffffe6, 27}, // (241) 258636ce33bSDmitri Tikhonov { 0x3ffffec, 26}, // (242) 259636ce33bSDmitri Tikhonov { 0x3ffffed, 26}, // (243) 260636ce33bSDmitri Tikhonov { 0x7ffffe7, 27}, // (244) 261636ce33bSDmitri Tikhonov { 0x7ffffe8, 27}, // (245) 262636ce33bSDmitri Tikhonov { 0x7ffffe9, 27}, // (246) 263636ce33bSDmitri Tikhonov { 0x7ffffea, 27}, // (247) 264636ce33bSDmitri Tikhonov { 0x7ffffeb, 27}, // (248) 265636ce33bSDmitri Tikhonov { 0xffffffe, 28}, // (249) 266636ce33bSDmitri Tikhonov { 0x7ffffec, 27}, // (250) 267636ce33bSDmitri Tikhonov { 0x7ffffed, 27}, // (251) 268636ce33bSDmitri Tikhonov { 0x7ffffee, 27}, // (252) 269636ce33bSDmitri Tikhonov { 0x7ffffef, 27}, // (253) 270636ce33bSDmitri Tikhonov { 0x7fffff0, 27}, // (254) 271636ce33bSDmitri Tikhonov { 0x3ffffee, 26}, // (255) 272636ce33bSDmitri Tikhonov { 0x3fffffff, 30} // EOS (256) 273636ce33bSDmitri Tikhonov}; 274636ce33bSDmitri Tikhonov 275636ce33bSDmitri Tikhonov 276636ce33bSDmitri Tikhonovstatic void 277636ce33bSDmitri Tikhonovgenerate_entry (uint16_t idx) 278636ce33bSDmitri Tikhonov{ 279636ce33bSDmitri Tikhonov uint8_t i, j; 280636ce33bSDmitri Tikhonov 281636ce33bSDmitri Tikhonov j = idx >> 8; 282636ce33bSDmitri Tikhonov i = idx; 283636ce33bSDmitri Tikhonov 284636ce33bSDmitri Tikhonov if (encode_table[i].bits + encode_table[j].bits <= 32) 285636ce33bSDmitri Tikhonov printf(" [I(%hhu,%hhu)] = {%u,0x%X},\n", 286636ce33bSDmitri Tikhonov i, j, 287636ce33bSDmitri Tikhonov encode_table[i].bits + encode_table[j].bits, 288636ce33bSDmitri Tikhonov (encode_table[i].code << encode_table[j].bits) 289636ce33bSDmitri Tikhonov | encode_table[j].code); 290636ce33bSDmitri Tikhonov else 291636ce33bSDmitri Tikhonov printf(" [I(%hhu,%hhu)] = {64,0},\n", i, j); 292636ce33bSDmitri Tikhonov} 293636ce33bSDmitri Tikhonov 294636ce33bSDmitri Tikhonov 295636ce33bSDmitri Tikhonovint 296636ce33bSDmitri Tikhonovmain (void) 297636ce33bSDmitri Tikhonov{ 298636ce33bSDmitri Tikhonov unsigned idx; 299636ce33bSDmitri Tikhonov 300636ce33bSDmitri Tikhonov printf( 301636ce33bSDmitri Tikhonov "#if __BYTE_ORDER == __LITTLE_ENDIAN\n" 302636ce33bSDmitri Tikhonov "#define I(i,j) ((j<<8)|i)\n" 303636ce33bSDmitri Tikhonov "#else\n" 304636ce33bSDmitri Tikhonov "#define I(i,j) ((i<<8)|j)\n" 305636ce33bSDmitri Tikhonov "#endif\n" 306636ce33bSDmitri Tikhonov ); 307636ce33bSDmitri Tikhonov printf("static const struct henc { unsigned lens; uint32_t code; } " 308636ce33bSDmitri Tikhonov "hencs[] =\n{\n"); 309636ce33bSDmitri Tikhonov for (idx = 0; idx <= UINT16_MAX; ++idx) 310636ce33bSDmitri Tikhonov generate_entry(idx); 311636ce33bSDmitri Tikhonov printf("};\n"); 312636ce33bSDmitri Tikhonov printf("#undef I\n"); 313636ce33bSDmitri Tikhonov 314636ce33bSDmitri Tikhonov return 0; 315636ce33bSDmitri Tikhonov} 316