1/* Copyright (C) 2011-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_DETAIL_INSN_F_SIGN_H
9#define LIBSIMDPP_SIMDPP_DETAIL_INSN_F_SIGN_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/core/bit_and.h>
17#include <simdpp/detail/null/math.h>
18
19namespace simdpp {
20namespace SIMDPP_ARCH_NAMESPACE {
21namespace detail {
22namespace insn {
23
24
25template<unsigned N> SIMDPP_INL
26float32<N> i_sign(const float32<N>& a)
27{
28 return bit_and(a, 0x80000000);
29}
30
31template<unsigned N> SIMDPP_INL
32float64<N> i_sign(const float64<N>& a)
33{
34 return bit_and(a, 0x8000000000000000);
35}
36
37
38} // namespace insn
39} // namespace detail
40} // namespace SIMDPP_ARCH_NAMESPACE
41} // namespace simdpp
42
43#endif
44
45