Preprocessor directives

Hi,

I have to translate some C code to Cuda.

There are some preprocessor directives that must be included.

Example:

[codebox]

#define min(X, Y) ((X) < (Y) ? (X) : (Y))

   x = min(a, b );          ==>  x = ((a) < (b ) ? (a) : (b ));

   y = min(1, 2 );          ==>  y = ((1) < (2) ? (1) : (2));

   z = min(a + 28, *p);    ==>  z = ((a + 28) < (*p) ? (a + 28) : (*p));

#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */

#ifdef ARCH_IS_BIG_ENDIAN

define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)

#else

define BYTE_ORDER 0

#endif[/codebox]

compiler returns this error:

myCUDAprogram.cu(88): error: calling a host function from a device/global function is only allowed in device emulation mode

How can I solve?

Thank’s.