From a43448df13147b06d2ebe9aeccd8810f802736e0 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Fri, 14 May 2010 09:40:17 +0100 Subject: [PATCH] Fix for iPhone3.1 atomics. Small addition to Range class. --- juce_amalgamated.h | 10 ++++++++-- src/containers/juce_Range.h | 6 ++++++ src/core/juce_Atomic.h | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 746d0ca95a..d8b7bd0a16 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -5728,8 +5728,8 @@ public: || (JUCE_MAC && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) #define JUCE_ATOMICS_MAC 1 // Older OSX builds using gcc4.1 or earlier - #if JUCE_PPC - // None of these atomics are available in a PPC build!! + #if JUCE_PPC || JUCE_IPHONE + // None of these atomics are available for PPC or for iPhoneOS 3.1 or earlier!! template static Type OSAtomicAdd64 (Type b, volatile Type* a) throw() { jassertfalse; return *a += b; } template static Type OSAtomicIncrement64 (volatile Type* a) throw() { jassertfalse; return ++*a; } template static Type OSAtomicDecrement64 (volatile Type* a) throw() { jassertfalse; return --*a; } @@ -9998,6 +9998,12 @@ public: return jlimit (start, end, value); } + /** Returns true if the given range lies entirely inside this range. */ + bool contains (const Range& other) const throw() + { + return start <= other.start && end >= other.end; + } + /** Returns true if the given range intersects this one. */ bool intersects (const Range& other) const throw() { diff --git a/src/containers/juce_Range.h b/src/containers/juce_Range.h index 3fe17d6990..fc37e51863 100644 --- a/src/containers/juce_Range.h +++ b/src/containers/juce_Range.h @@ -213,6 +213,12 @@ public: return jlimit (start, end, value); } + /** Returns true if the given range lies entirely inside this range. */ + bool contains (const Range& other) const throw() + { + return start <= other.start && end >= other.end; + } + /** Returns true if the given range intersects this one. */ bool intersects (const Range& other) const throw() { diff --git a/src/core/juce_Atomic.h b/src/core/juce_Atomic.h index f5299aa8b5..2442f9b075 100644 --- a/src/core/juce_Atomic.h +++ b/src/core/juce_Atomic.h @@ -156,8 +156,8 @@ public: || (JUCE_MAC && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) #define JUCE_ATOMICS_MAC 1 // Older OSX builds using gcc4.1 or earlier - #if JUCE_PPC - // None of these atomics are available in a PPC build!! + #if JUCE_PPC || JUCE_IPHONE + // None of these atomics are available for PPC or for iPhoneOS 3.1 or earlier!! template static Type OSAtomicAdd64 (Type b, volatile Type* a) throw() { jassertfalse; return *a += b; } template static Type OSAtomicIncrement64 (volatile Type* a) throw() { jassertfalse; return ++*a; } template static Type OSAtomicDecrement64 (volatile Type* a) throw() { jassertfalse; return --*a; }