Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
q/kdb+ 0.53 KB | None | 0 0
  1. /* The below code does not do input validation. It assumes the input string is a sequence of numbers */
  2.  
  3. ReallyBigRegister D;
  4. char c;
  5. char EOL = 0x0D;
  6. char Subtract1 = 0x30;
  7. char Subtract2 = 0x37; // Might require some fine-tuning
  8.  
  9. Start:
  10.  
  11. For each character in String
  12. c = String[x];
  13.    If c =/= EOL        // Check if character is end of line
  14.         If c > 39
  15.            c = c-Subtract1;
  16.            Goto Shift
  17.         Else
  18.            c = c-Subtract2;
  19.    Else
  20.  
  21.  
  22. Shift:
  23.  
  24. D=(D<<4)|c;
  25. //Could also use (D<<4)+c;
  26. Goto Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement