1/* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt>
2
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6*/
7
8#ifndef LIBSIMDPP_SIMDPP_CORE_F_CEIL_H
9#define LIBSIMDPP_SIMDPP_CORE_F_CEIL_H
10
11#ifndef LIBSIMDPP_SIMD_H
12 #error "This file must be included through simd.h"
13#endif
14
15#include <simdpp/types.h>
16#include <simdpp/detail/insn/f_ceil.h>
17
18namespace simdpp {
19namespace SIMDPP_ARCH_NAMESPACE {
20
21
22/** Rounds the values a vector towards positive infinity
23
24 @code
25 r0 = ceil(a0)
26 ...
27 rN = ceil(aN)
28 @endcode
29
30 @par 128-bit version:
31 @icost{SSE2, SSE3, SSSE3, 13-15}
32 @icost{NEON, 11-13}
33
34 @par 256-bit version:
35 @icost{SSE2, SSE3, SSSE3, 26-28}
36 @icost{NEON, 22-24}
37 @icost{ALTIVEC, 2}
38*/
39template<unsigned N, class E> SIMDPP_INL
40float32<N,expr_empty> ceil(const float32<N,E>& a)
41{
42 return detail::insn::i_ceil(a.eval());
43}
44template<unsigned N, class E> SIMDPP_INL
45float64<N,expr_empty> ceil(const float64<N,E>& a)
46{
47 return detail::insn::i_ceil(a.eval());
48}
49
50} // namespace SIMDPP_ARCH_NAMESPACE
51} // namespace simdpp
52
53#endif
54
55