summaryrefslogtreecommitdiff
path: root/include/linux/overflow-arith.h
blob: e12ccf854a70f9797f337d86c0efb9b8eb43b98e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once

#include <linux/kernel.h>

#ifdef CC_HAVE_BUILTIN_OVERFLOW

#define overflow_usub __builtin_usub_overflow

#else

static inline bool overflow_usub(unsigned int a, unsigned int b,
				 unsigned int *res)
{
	*res = a - b;
	return *res > a ? true : false;
}

#endif