20#include "local_proto.h"
34#define SEG_SEEK_FAST(SEG, n, index) \
35 ((((off_t)(n)) << (SEG)->sizebits) + (index) + (SEG)->offset)
37#define SEG_SEEK_SLOW(SEG, n, index) \
38 ((off_t)(n) * (SEG)->size + (index) + (SEG)->offset)
42 if (lseek((SEG)->fd,
SEG_SEEK_FAST(SEG, n, index), SEEK_SET) == (off_t)-1) {
51 if (lseek((SEG)->fd,
SEG_SEEK_SLOW(SEG, n, index), SEEK_SET) == (off_t)-1) {
58int seg_seek(
const SEGMENT *SEG,
int n,
int index)
60 return SEG->seek(SEG, n, index);
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int seg_seek(const SEGMENT *SEG, int n, int index)
int seg_seek_fast(const SEGMENT *SEG, int n, int index)
int seg_seek_slow(const SEGMENT *SEG, int n, int index)
#define SEG_SEEK_FAST(SEG, n, index)
Internal use only.
#define SEG_SEEK_SLOW(SEG, n, index)