All pastes #946949 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-03-18 01:43 UTC
rendered paste body
/*
*  converts the within buffer(LARD_PTR) pointer to a system wide pointer
*/
void * conv_to_ptr(const lardbuffer *b, LARD_PTR ptr) {
    return (char *)b+HEADER_SIZE+ptr*(b->size);
}
/*
*  converts a systemwide pointer to somewhere inside the buffer into an LARD_PTR which points locally
*/
LARD_PTR conv_to_short(const lardbuffer *b, const void * ptr) {
    return ((char *)ptr-(char *)b-HEADER_SIZE)/(b->size);
}