Browse files

Initial commit

  • Loading branch information...
0 parents commit 25c5f41efae850510b21151a78029378b4731577 @tj tj committed Jul 5, 2012
Showing with 36 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. 0 History.md
  3. +11 −0 Readme.md
  4. +7 −0 package.conf
  5. +17 −0 unlikely.h
1 .gitignore
@@ -0,0 +1 @@
+test
0 History.md
No changes.
11 Readme.md
@@ -0,0 +1,11 @@
+
+# unlikely
+
+ GCC branch prediction macros.
+
+## API
+
+```c
+likely(expr)
+unlikely(expr)
+```
7 package.conf
@@ -0,0 +1,7 @@
+name: unlikely
+version: 0.0.1
+description: branch prediction macros
+tags: macro unlikely branch gcc
+author: TJ Holowaychuk <tj@vision-media.ca>
+url: http://github.com/visionmedia/unlikely.c
+
17 unlikely.h
@@ -0,0 +1,17 @@
+
+//
+// unlikely.h
+//
+
+#ifndef UNLIKELY_H
+#define UNLIKELY_H
+
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#define likely(expr) __builtin_expect((expr), 1)
+#define unlikely(expr) __builtin_expect((expr), 0)
+#else
+#define likely(expr) (expr)
+#define unlikely(expr) (expr)
+#endif
+
+#endif

0 comments on commit 25c5f41

Please sign in to comment.