1 /****************************************************************************
5 * Purpose: Helper functions for common interfaces using UFFI
6 * Programmer: Kevin M. Rosenberg
7 * Date Started: Mar 2002
9 * This file, part of CLSQL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
11 * CLSQL users are granted the rights to distribute and use this software
12 * as governed by the terms of the Lisp Lesser GNU Public License
13 * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
14 ***************************************************************************/
16 #if defined(WIN32)||defined(WIN64)
19 BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
25 #define DLLEXPORT __declspec(dllexport)
32 const unsigned int bitmask_32bits = 0xFFFFFFFF;
33 #define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
34 #define upper_32bits(int64) ((unsigned int) (int64 >> 32))
36 /* Reads a 64-bit integer string, returns result as two 32-bit integers */
40 atol64 (const unsigned char* str, unsigned int* pHigh32)
42 #if defined(WIN32)||defined(WIN64)
48 int first_char = *str;
49 if (first_char == '+')
51 else if (first_char == '-') {
58 if (i < 0 || i > 9) /* Non-numeric character -- quit */
60 result = i + (10 * result);
66 *pHigh32 = upper_32bits(result);
67 return lower_32bits(result);