X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/libsecurity_cryptkit/ckutils/ckutilsPlatform.h diff --git a/libsecurity_cryptkit/ckutils/ckutilsPlatform.h b/libsecurity_cryptkit/ckutils/ckutilsPlatform.h deleted file mode 100644 index 66ee7bcb..00000000 --- a/libsecurity_cryptkit/ckutils/ckutilsPlatform.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Platform-dependent stuff for ckutils - */ - -#ifndef _CKU_PLATFORM_H_ -#define _CKU_PLATFORM_H_ - -#include -#include - -/* use this for linux compatibility testing */ -//#define linux 1 -/* end linux test */ - -/* - * Make sure endianness is defined... - */ -#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) - #if macintosh - #define __BIG_ENDIAN__ 1 - #elif defined(i386) || defined(i486) || defined(__i386__) || defined(__i486__) - #define __LITTLE_ENDIAN__ 1 - #else - #error Platform dependent work needed - #endif -#endif /* endian */ - -#ifdef NeXT - #import - #define SRAND(x) srandom(x) - #define RAND() random() -#else NeXT - /* - * Use stdlib only - */ - #define SRAND(x) srand(x) - #define RAND() rand() - #define bcopy(s, d, l) memmove(d, s, l) - #define bzero(s, l) memset(s, 0, l) - #define bcmp(s, d, l) memcmp(s, d, l) -#endif - -#ifdef CK_NT_C_ONLY - -/* - * Standard I/O redirects for WINNT. - */ -#define open(f, b, c) _open(f, b, c) -#define close(f) _close(f) -#define read(f, b, c) _read(f, b, c) -#define write(f, b, c) _write(f, b, c) -#define fstat(f, b) _fstat(f, b) - -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC - -#endif CK_NT_C_ONLY - -/* - * Platform-dependent timestamp stuff. For now we assume that each platform - * has some kind of struct which maintains a high-resolution clock and - * a function which fills that struct with the current time. - */ -#if macintosh - - #include - - #define PLAT_TIME UnsignedWide - #define PLAT_GET_TIME(pt) Microseconds(&pt) - #define PLAT_GET_US(start,end) (end.lo - start.lo) - -#elif linux - - #include - - #define PLAT_TIME struct timeval - #define PLAT_GET_TIME(pt) gettimeofday(&pt, NULL) - #define PLAT_GET_US(start,end) \ - ( ( ( (end.tv_sec & 0xff) * 1000000) + end.tv_usec) - \ - ( ( (start.tv_sec & 0xff) * 1000000) + start.tv_usec) ) - -#elif NeXT - - #include - - #define PLAT_TIME struct tsval - #define PLAT_GET_TIME(pt) kern_timestamp(&pt) - #define PLAT_GET_US(start,end) (end.low_val - start.low_val) - - -#elif defined(__MACH__) && defined(__APPLE__) - #include - /* time as a double */ - #define PLAT_TIME CFAbsoluteTime - #define PLAT_GET_TIME(pt) pt = CFAbsoluteTimeGetCurrent() - #define PLAT_GET_US(start,end) \ - ((end - start) * 1000000.0) - #define PLAT_GET_NS(start,end) \ - ((end - start) * 1000000000.0) -#else - #error Platform dependent work needed -#endif - -#endif /* _CKU_PLATFORM_H_ */