]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - libc/private/bionic_macros.h
implement missing seekdir and telldir
[android-sdk/platform-bionic.git] / libc / private / bionic_macros.h
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
17 #ifndef _BIONIC_MACROS_H_
18 #define _BIONIC_MACROS_H_
20 // DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
21 // It goes in the private: declarations in a class.
22 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
23   TypeName(const TypeName&) = delete;      \
24   void operator=(const TypeName&) = delete
26 // A macro to disallow all the implicit constructors, namely the
27 // default constructor, copy constructor and operator= functions.
28 //
29 // This should be used in the private: declarations for a class
30 // that wants to prevent anyone from instantiating it. This is
31 // especially useful for classes containing only static methods.
32 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
33   TypeName() = delete;                           \
34   DISALLOW_COPY_AND_ASSIGN(TypeName)
36 #define BIONIC_ALIGN(value, alignment) \
37   (((value) + (alignment) - 1) & ~((alignment) - 1))
39 #define BIONIC_ROUND_UP_POWER_OF_2(value) \
40   (sizeof(value) == 8) \
41     ? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
42     : (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value))))
44 #endif // _BIONIC_MACROS_H_