Set tval to 0 on traps with no specified tval
[riscv-isa-sim.git] / riscv / common.h
index 447d6311226380d4e63e667de2a4c2e7828d16eb..8ddd9849d83c887647c1a46b39d86d11514726a8 100644 (file)
@@ -1,23 +1,9 @@
+// See LICENSE for license details.
+
 #ifndef _RISCV_COMMON_H
 #define _RISCV_COMMON_H
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-# include <stdexcept>
-# define print_and_die(s) throw std::runtime_error(s)
-#else
-# define print_and_die(s) do { fprintf(stderr,"%s\n",s); abort(); } while(0)
-#endif
-
-#define demand(cond,str,...) \
-  do { if(!(cond)) { \
-      char __str[256]; \
-      snprintf(__str,256,"in %s, line %d: " str, \
-               __FILE__,__LINE__,##__VA_ARGS__); \
-      print_and_die(__str); \
-    } } while(0)
+#define   likely(x) __builtin_expect(x, 1)
+#define unlikely(x) __builtin_expect(x, 0)
 
 #endif