#ifndef DONE_FILE64
#define DONE_FILE64 1
#ifdef WIN32

#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

#ifndef HAVE_BIGINT
#define HAVE_BIGINT
typedef __int64 bigint;
typedef unsigned __int64 ubigint;
#endif
#define open64 _open
#define lseek64 _lseeki64
#define tell64 _telli64
#define write64 _write
#define read64 _read
#define close64 _close
#define stat64 _stati64
#define fstat64 _fstati64
#define atoll _atoi64


#else
#include <sys/types.h>
#include <stdio.h>

#ifdef _LARGEFILE_SOURCE
#ifndef HAVE_BIGINT
#define HAVE_BIGINT
typedef off64_t bigint;
typedef unsigned long long ubigint;
#endif
#define write64 write
#define read64 read
#define close64 close

#else

#ifndef HAVE_BIGINT
#define HAVE_BIGINT
typedef off_t bigint;
#endif
#define fseeko fseek
#define ftello ftell
#endif
#endif

#ifdef DO_IOS
#define lseek64 lseek
#define open64 open
#endif

#ifdef DO_OSX
#define lseek64 lseek
#define open64 open
#endif


bigint lib_file_osize64(int f);
char *bigint_to_str(bigint x, char *tmp);

char *bigint_to_strx(bigint x, char *tmp);
bigint bigint_file_size(char *fname);

bigint str_to_bigint(char *tmp);
char* lib_itoa_bigint(char *s, bigint i);
char *nice_num_big(bigint d, char *tmp);
#endif
