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

Commit 51c2088f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Usage suggestions."

parents e1d9e7c3 b8f152d3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef ANDROID_UTILS_ATOMIC_H
#define ANDROID_UTILS_ATOMIC_H

// DO NOT USE: Please instead use std::atomic

#include <cutils/atomic.h>

#endif // ANDROID_UTILS_ATOMIC_H
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@

/*
 * Contains some bit manipulation helpers.
 *
 * DO NOT USE: std::bitset<32> or std::bitset<64> preferred
 */

namespace android {
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
namespace android {
// ---------------------------------------------------------------------------

// DO NOT USE: please use std::condition_variable instead.

/*
 * Condition variable class.  The implementation is system-dependent.
 *
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ template<> struct CompileTimeAssert<true> {};
#define COMPILE_TIME_ASSERT(_exp) \
    template class CompileTimeAssert< (_exp) >;
#endif

// DO NOT USE: Please use static_assert instead
#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \
    CompileTimeAssert<( _exp )>();

+2 −2
Original line number Diff line number Diff line
@@ -33,13 +33,13 @@ class FlattenableUtils {
public:
    template<size_t N>
    static size_t align(size_t size) {
        COMPILE_TIME_ASSERT_FUNCTION_SCOPE( !(N & (N-1)) );
        static_assert(!(N & (N - 1)), "Can only align to a power of 2.");
        return (size + (N-1)) & ~(N-1);
    }

    template<size_t N>
    static size_t align(void const*& buffer) {
        COMPILE_TIME_ASSERT_FUNCTION_SCOPE( !(N & (N-1)) );
        static_assert(!(N & (N - 1)), "Can only align to a power of 2.");
        uintptr_t b = uintptr_t(buffer);
        buffer = reinterpret_cast<void*>((uintptr_t(buffer) + (N-1)) & ~(N-1));
        return size_t(uintptr_t(buffer) - b);
Loading