LibreOffice Module tools (master) 1
simd.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 */
10
11#ifndef INCLUDED_TOOLS_SIMD_HXX
12#define INCLUDED_TOOLS_SIMD_HXX
13
14namespace simd
15{
16template <typename T, unsigned int N> inline bool isAligned(const T* pointer)
17{
18 return 0 == (uintptr_t(pointer) % N);
19}
20
21template <typename T> inline T roundDown(T value, unsigned int multiple)
22{
23 return value & ~(multiple - 1);
24}
25
26} // end namespace simd
27
28#endif // INCLUDED_TOOLS_SIMD_HXX
29
30/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Any value
Definition: simd.hxx:15
bool isAligned(const T *pointer)
Definition: simd.hxx:16
T roundDown(T value, unsigned int multiple)
Definition: simd.hxx:21
#define N