Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d023d56e authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Merge "AUtils: disable overflow checks for isInRange" am: 85f1c3c5 am: 7ce60542

am: 5440be5e

* commit '5440be5e':
  AUtils: disable overflow checks for isInRange

Change-Id: If2213313fba4dfca3de9e3b61732de62eac598f6
parents da4981b0 5440be5e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ void ENSURE_UNSIGNED_TYPE() {

// needle is in range [hayStart, hayStart + haySize)
template<class T, class U>
__attribute__((no_sanitize("integer")))
inline static bool isInRange(const T &hayStart, const U &haySize, const T &needle) {
    ENSURE_UNSIGNED_TYPE<U>();
    return (T)(hayStart + haySize) >= hayStart && needle >= hayStart && (U)(needle - hayStart) < haySize;
@@ -75,6 +76,7 @@ inline static bool isInRange(const T &hayStart, const U &haySize, const T &needl

// [needleStart, needleStart + needleSize) is in range [hayStart, hayStart + haySize)
template<class T, class U>
__attribute__((no_sanitize("integer")))
inline static bool isInRange(
        const T &hayStart, const U &haySize, const T &needleStart, const U &needleSize) {
    ENSURE_UNSIGNED_TYPE<U>();