]> git.baikalelectronics.ru Git - kernel.git/commit
overflow-arith: begin to add support for overflow builtin functions
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Fri, 16 Oct 2015 09:32:42 +0000 (11:32 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Oct 2015 09:49:35 +0000 (02:49 -0700)
commit72c87b0421b877b462c06acb8c853bed21e7873c
treede48a8a1009dc237100ccdfff795da27aae4e61c
parent4c827445848f066190fceea67edc6f50f74b9d0a
overflow-arith: begin to add support for overflow builtin functions

The idea of the overflow-arith.h header is to collect overflow checking
functions in one central place.

If gcc compiler supports the __builtin_overflow_* builtins we use them
because they might give better performance, otherwise the code falls
back to normal overflow checking functions.

The builtin_overflow functions are supported by gcc-5 and clang. The
matter of supporting clang is to just provide a corresponding
CC_HAVE_BUILTIN_OVERFLOW, because the specific overflow checking builtins
don't differ between gcc and clang.

I just provide overflow_usub function here as I intend this to get merged
into net, more functions will definitely follow as they are needed.

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/compiler-gcc.h
include/linux/overflow-arith.h [new file with mode: 0644]