[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / include / platform / acgcc.h
index 47588a2..1512e5b 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2016, Intel Corp.
+ * Copyright (C) 2000 - 2017, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #ifndef __ACGCC_H__
 #define __ACGCC_H__
 
+/*
+ * Use compiler specific <stdarg.h> is a good practice for even when
+ * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
+ */
+#include <stdarg.h>
+
 #define ACPI_INLINE             __inline__
 
 /* Function name is used for debug output. Non-ANSI, compiler-dependent */
  */
 #define ACPI_UNUSED_VAR __attribute__ ((unused))
 
-/*
- * Some versions of gcc implement strchr() with a buggy macro. So,
- * undef it here. Prevents error messages of this form (usually from the
- * file getopt.c):
- *
- * error: logical '&&' with non-zero constant will always evaluate as true
- */
-#ifdef strchr
-#undef strchr
-#endif
-
 /* GCC supports __VA_ARGS__ in macros */
 
 #define COMPILER_VA_MACRO               1
@@ -131,20 +126,17 @@ do {                                                        \
 } while(0)
 
 
-/*
- * Note: This is also taken from our old adaptation.
- *       See acmsvc.h for where it came originally.
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-{                           \
-    q32 = n_hi / d32;       \
-    r32 = n_lo / d32;       \
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32)                \
+{                                                                   \
+    asm("divl %4;"                                                  \
+        :"=a"(q32),"=d"(r32):"a"(n_lo),"d"(n_hi),"rm"(d32):"cc");   \
 }
 
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-{                           \
-    n_hi >>= 1;    \
-    n_lo >>= 1;    \
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo)                     \
+{                                                           \
+    asm("shrl $1, %0;"                                      \
+        "rcrl $1, %1;"                                      \
+        :"=rm"(n_hi),"=rm"(n_lo):"0"(n_hi),"1"(n_lo):"cc"); \
 }
 
 #endif /* __REACTOS__ */