blob: 3cdfbe08df4cda474ea7638cd621792c46ced993 [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
John Koleszar0ea50ce2010-05-18 11:58:33 -040010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AOM_MEM_INCLUDE_AOM_MEM_INTRNL_H_
13#define AOM_MEM_INCLUDE_AOM_MEM_INTRNL_H_
14#include "./aom_config.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -040015
clang-format031d46c2016-08-10 18:35:20 -070016#define ADDRESS_STORAGE_SIZE sizeof(size_t)
John Koleszar0ea50ce2010-05-18 11:58:33 -040017
18#ifndef DEFAULT_ALIGNMENT
clang-format031d46c2016-08-10 18:35:20 -070019#if defined(VXWORKS)
Yaowu Xuf883b422016-08-30 14:01:10 -070020/*default addr alignment to use in calls to aom_* functions other than
Yaowu Xu9c01aa12016-09-01 14:32:49 -070021 aom_memalign*/
clang-format031d46c2016-08-10 18:35:20 -070022#define DEFAULT_ALIGNMENT 32
23#else
24#define DEFAULT_ALIGNMENT (2 * sizeof(void *)) /* NOLINT */
25#endif
John Koleszar0ea50ce2010-05-18 11:58:33 -040026#endif
27
John Koleszar0ea50ce2010-05-18 11:58:33 -040028/*returns an addr aligned to the byte boundary specified by align*/
clang-format031d46c2016-08-10 18:35:20 -070029#define align_addr(addr, align) \
James Zern20b85982016-08-27 10:34:40 -070030 (void *)(((size_t)(addr) + ((align)-1)) & ~(size_t)((align)-1))
John Koleszar0ea50ce2010-05-18 11:58:33 -040031
Yaowu Xuf883b422016-08-30 14:01:10 -070032#endif // AOM_MEM_INCLUDE_AOM_MEM_INTRNL_H_