|
Packit Service |
310c69 |
/*
|
|
Packit Service |
310c69 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
310c69 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
310c69 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
310c69 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
310c69 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
310c69 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
310c69 |
* GNU General Public License for more details.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
310c69 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
310c69 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
310c69 |
* 02110-1301, USA.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* $Id: //eng/uds-releases/jasper/src/uds/compiler.h#1 $
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#ifndef COMMON_COMPILER_H
|
|
Packit Service |
310c69 |
#define COMMON_COMPILER_H
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "compilerDefs.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
// Count the elements in a static array while attempting to catch some type
|
|
Packit Service |
310c69 |
// errors. (See http://stackoverflow.com/a/1598827 for an explanation.)
|
|
Packit Service |
310c69 |
#define COUNT_OF(x) ((sizeof(x) / sizeof(0[x])) \
|
|
Packit Service |
310c69 |
/ ((size_t) (!(sizeof(x) % sizeof(0[x])))))
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#define const_container_of(ptr, type, member) \
|
|
Packit Service |
310c69 |
__extension__ ({ \
|
|
Packit Service |
310c69 |
const __typeof__(((type *)0)->member) *__mptr = (ptr); \
|
|
Packit Service |
310c69 |
(const type *)((const char *)__mptr - offsetof(type,member)); \
|
|
Packit Service |
310c69 |
})
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
// The "inline" keyword alone takes affect only when the optimization level
|
|
Packit Service |
310c69 |
// is high enough. Define INLINE to force the gcc to "always inline".
|
|
Packit Service |
310c69 |
#define INLINE __attribute__((always_inline)) inline
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#endif /* COMMON_COMPILER_H */
|