Created
May 19, 2018 00:57
-
-
Save kkevlar/28e48deeb57b45ebf182e0a5fd070d6d to your computer and use it in GitHub Desktop.
noahs a goon
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
int header_set_uid_itsbig(char* where, size_t size, int32_t val) | |
{ | |
int err = 0; | |
if (val < 0 || size < sizeof(val)) | |
{ | |
err++; | |
} | |
else | |
{ | |
memset(where, 0, size); | |
*(int32_t *)(where+size-sizeof(val)) = htonl(val); | |
*where |= 0x80; | |
} | |
return err; | |
} | |
void header_set_uid_bigsafe(char* buf, int32_t uid) | |
{ | |
int toobig = 07777777; | |
if(uid > toobig) | |
{ | |
header_set_uid_itsbig(buf,8,uid); | |
} | |
else | |
{ | |
header_8octal(buf, uid); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment