Advertisement
Guest User

missing bits

a guest
Jun 12th, 2013
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. // hansi: hextable from
  2. // http://stackoverflow.com/questions/10324/how-can-i-convert-a-hexadecimal-number-to-base-10-efficiently-in-c
  3. static const long HEX2DEC[] = {
  4.     [0 ... 255] = -1, // bit aligned access into this table is considerably
  5.     ['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // faster for most modern processors,
  6.     ['A'] = 10, 11, 12, 13, 14, 15,       // for the space conscious, reduce to
  7.     ['a'] = 10, 11, 12, 13, 14, 15        // signed char.
  8. };
  9.  
  10. // http://en.wikipedia.org/wiki/Percent-encoding#Types_of_URI_characters
  11. static bool SAFE[256] = {
  12.     [0 ... 255] = false,
  13.     ['a'...'z'] = true,
  14.     ['A'...'Z'] = true,
  15.     ['0'...'9'] = true,
  16.     ['.'] = true
  17. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement