Skip to content

Instantly share code, notes, and snippets.

@laheadle
Created January 2, 2013 03:26
Show Gist options
  • Save laheadle/4431879 to your computer and use it in GitHub Desktop.
Save laheadle/4431879 to your computer and use it in GitHub Desktop.
function putb(buf, type, where, what)
local bp = ffi.cast('uint8_t*', buf)
local ptr = ffi.cast(type..'*', bp + where)
ptr[0] = what
end
function getb(buf, type, where)
local bp = ffi.cast('uint8_t*', buf)
return ffi.cast(type..'*', bp + where)[0]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment