odk directory copied from wvgerrit. branch oemcrypto-v16 commit 0c9a7dc Bug: 140758896 Test: odk_test Change-Id: I0c631f771b794468a63e4395f6b9c3b60a1dfd4f
34 lines
832 B
C
34 lines
832 B
C
/*
|
|
* Copyright 2019 Google LLC. All Rights Reserved. This file and proprietary
|
|
* source code may only be used and distributed under the Widevine Master
|
|
* License Agreement.
|
|
*/
|
|
|
|
#ifndef ODK_OVERFLOW_H_
|
|
#define ODK_OVERFLOW_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifndef __has_builtin
|
|
# define __has_builtin(x) 0
|
|
#endif
|
|
|
|
#if (defined(__GNUC__) && __GNUC__ >= 5) || \
|
|
__has_builtin(__builtin_add_overflow)
|
|
# define odk_sub_overflow_u64 __builtin_sub_overflow
|
|
# define odk_add_overflow_u64 __builtin_add_overflow
|
|
# define odk_add_overflow_ux __builtin_add_overflow
|
|
#else
|
|
int odk_sub_overflow_u64(uint64_t a, uint64_t b, uint64_t* c);
|
|
int odk_add_overflow_u64(uint64_t a, uint64_t b, uint64_t* c);
|
|
int odk_add_overflow_ux(size_t a, size_t b, size_t* c);
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ODK_OVERFLOW_H_ */
|