Skip to content
Snippets Groups Projects
Commit 87ad66ee authored by Marek Vavruša's avatar Marek Vavruša
Browse files

lib: helping compiler with early returns

parent 46122a59
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,10 @@
* Error codes.
*/
#define kr_ok() 0
#define kr_error(x) -abs(x)
/* Mark as cold to mark all branches as unlikely. */
static inline int __attribute__((__cold__)) kr_error(int x) {
return -abs(x);
}
#define kr_strerror(x) strerror(abs(x))
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment