Created
January 25, 2013 00:39
-
-
Save richo/4630407 to your computer and use it in GitHub Desktop.
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
signed | |
WS_Reserve(struct ws *ws, unsigned bytes) | |
{ | |
unsigned b2; | |
WS_Assert(ws); | |
assert(ws->r == NULL); | |
if (bytes == 0) | |
b2 = ws->e - ws->f; | |
else if (bytes > ws->e - ws->f) | |
b2 = ws->e - ws->f; | |
else | |
b2 = bytes; | |
b2 = PRNDDN(b2); | |
xxxassert(ws->f + b2 <= ws->e); | |
ws->r = ws->f + b2; | |
DSL(DBG_WORKSPACE, 0, "WS_Reserve(%p, %u/%u) = %u", | |
ws, b2, bytes, pdiff(ws->f, ws->r)); | |
WS_Assert(ws); | |
return (pdiff(ws->f, ws->r)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment