Last active
March 1, 2020 00:39
-
-
Save vanbukin/490180dc1a76f4407b0d8f4f1f00d9c4 to your computer and use it in GitHub Desktop.
FormatD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private unsafe void FormatD(char* dest) | |
{ | |
// dddddddd-dddd-dddd-dddd-dddddddddddd | |
uint* destUints = (uint*)dest; | |
char** destUintsAsChars = (char**)&destUints; | |
uint* tableToHex = TableToHex; | |
dest[8] = dest[13] = dest[18] = dest[23] = '-'; | |
destUints[0] = tableToHex[(byte)(_a >> 24)]; | |
destUints[1] = tableToHex[(byte)(_a >> 16)]; | |
destUints[2] = tableToHex[(byte)(_a >> 8)]; | |
destUints[3] = tableToHex[(byte)_a]; | |
destUints[7] = tableToHex[(byte)(_c >> 8)]; | |
destUints[8] = tableToHex[(byte)_c]; | |
destUints[12] = tableToHex[_f]; | |
destUints[13] = tableToHex[_g]; | |
destUints[14] = tableToHex[_h]; | |
destUints[15] = tableToHex[_i]; | |
destUints[16] = tableToHex[_j]; | |
destUints[17] = tableToHex[_k]; | |
*destUintsAsChars += 1; | |
destUints[4] = tableToHex[(byte)(_b >> 8)]; | |
destUints[5] = tableToHex[(byte)_b]; | |
destUints[9] = tableToHex[_d]; | |
destUints[10] = tableToHex[_e]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment