ROOT
6.06/09
Reference Guide
ROOT Home Page
Main Page
Related Pages
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
math
vc
tests
vectormemoryhelper.h
Go to the documentation of this file.
1
/* This file is part of the Vc library.
2
3
Copyright (C) 2009 Matthias Kretz <kretz@kde.org>
4
5
Vc is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as
7
published by the Free Software Foundation, either version 3 of
8
the License, or (at your option) any later version.
9
10
Vc is distributed in the hope that it will be useful, but
11
WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with Vc. If not, see <http://www.gnu.org/licenses/>.
17
18
*/
19
20
#ifndef VECTORMEMORYHELPER_H
21
#define VECTORMEMORYHELPER_H
22
23
#include <
Vc/vector.h
>
24
25
template
<
typename
Vec>
26
class
VectorMemoryHelper
27
{
28
char
*
const
mem
;
29
char
*
const
aligned
;
30
public
:
31
VectorMemoryHelper
(
int
count)
32
: mem(new char[count * sizeof(Vec) +
Vc
::
VectorAlignment
]),
33
aligned(mem + (
Vc
::
VectorAlignment
- (reinterpret_cast<unsigned long>( mem ) & (
Vc
::
VectorAlignment
- 1 ))))
34
{
35
}
36
~VectorMemoryHelper
() {
delete
[]
mem
; }
37
38
operator
typename
Vec::EntryType *() {
return
reinterpret_cast<
typename Vec::EntryType *
>
(
aligned
); }
39
};
40
41
#endif // VECTORMEMORYHELPER_H
ROOT::Vc::AVX::VectorAlignment
Definition:
vector.h:46
VectorMemoryHelper::mem
char *const mem
Definition:
vectormemoryhelper.h:28
VectorMemoryHelper::VectorMemoryHelper
VectorMemoryHelper(int count)
Definition:
vectormemoryhelper.h:31
VectorMemoryHelper::~VectorMemoryHelper
~VectorMemoryHelper()
Definition:
vectormemoryhelper.h:36
VectorMemoryHelper
Definition:
vectormemoryhelper.h:26
vector.h
VectorMemoryHelper::aligned
char *const aligned
Definition:
vectormemoryhelper.h:29
ROOT::Vc
Definition:
casts.h:28