]> git.karo-electronics.de Git - linux-beck.git/blob - include/linux/overflow-arith.h
e12ccf854a70f9797f337d86c0efb9b8eb43b98e
[linux-beck.git] / include / linux / overflow-arith.h
1 #pragma once
2
3 #include <linux/kernel.h>
4
5 #ifdef CC_HAVE_BUILTIN_OVERFLOW
6
7 #define overflow_usub __builtin_usub_overflow
8
9 #else
10
11 static inline bool overflow_usub(unsigned int a, unsigned int b,
12                                  unsigned int *res)
13 {
14         *res = a - b;
15         return *res > a ? true : false;
16 }
17
18 #endif