/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "rtc_base/memory/aligned_malloc.h" #include <stdlib.h> // for free, malloc #include <string.h> // for memcpy #include "rtc_base/checks.h" #ifdef _WIN32 #include <windows.h> #else #include <stdint.h> #endif // Reference on memory alignment: // http://stackoverflow.com/questions/227897/solve-the-memory-alignment-in-c-interview-question-that-stumped-me namespace webrtc { uintptr_t GetRightAlign(uintptr_t start_pos, size_t alignment) { … } // Alignment must be an integer power of two. bool ValidAlignment(size_t alignment) { … } void* GetRightAlign(const void* pointer, size_t alignment) { … } void* AlignedMalloc(size_t size, size_t alignment) { … } void AlignedFree(void* mem_block) { … } } // namespace webrtc