1bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis/* 2bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz> 3bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * Copyright (c) 2013 Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> 48967f960f820f449162101a02ee5747f195a8a57Ngie Cooper * Copyright (c) 2010 Ngie Cooper <yaneurabeya@gmail.com> 5bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * Copyright (c) 2008 Mike Frysinger <vapier@gmail.com> 6bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * 7bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * This program is free software: you can redistribute it and/or modify 8bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * it under the terms of the GNU General Public License as published by 9bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * the Free Software Foundation, either version 2 of the License, or 10bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * (at your option) any later version. 11bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * 12bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * This program is distributed in the hope that it will be useful, 13bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * but WITHOUT ANY WARRANTY; without even the implied warranty of 14bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * GNU General Public License for more details. 16bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * 17bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * You should have received a copy of the GNU General Public License 18bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * along with this program. If not, see <http://www.gnu.org/licenses/>. 19bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis */ 20bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis 21bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#ifndef TST_COMMON_H__ 22bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define TST_COMMON_H__ 23bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis 24bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn)) 25bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define LTP_ATTRIBUTE_UNUSED __attribute__((unused)) 26bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result)) 27bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis 28bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#ifndef ARRAY_SIZE 29bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 30bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#endif 31bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis 32bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis/* Round x to the next multiple of a. 33bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis * a should be a power of 2. 34bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis */ 35bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define LTP_ALIGN(x, a) __LTP_ALIGN_MASK(x, (typeof(x))(a) - 1) 36bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#define __LTP_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) 37bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis 38bbdb9f78378c7e038f463efa39d2470e1c51ad54Cyril Hrubis#endif /* TST_COMMON_H__ */ 39