-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from JohanMabille/ldexp
ldexp
- Loading branch information
Showing
19 changed files
with
2,717 additions
and
960 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay * | ||
* * | ||
* Distributed under the terms of the BSD 3-Clause License. * | ||
* * | ||
* The full license is in the file LICENSE, distributed with this software. * | ||
****************************************************************************/ | ||
|
||
#ifndef XSIMD_FP_MANIPULATION_HPP | ||
#define XSIMD_FP_MANIPULATION_HPP | ||
|
||
#include "xsimd_numerical_constant.hpp" | ||
|
||
namespace xsimd | ||
{ | ||
|
||
template <class T, std::size_t N> | ||
batch<T, N> ldexp(const batch<T, N>& x, const batch<as_integer_t<T>, N>& e); | ||
|
||
/************************** | ||
* Generic implementation * | ||
**************************/ | ||
|
||
template <class T, std::size_t N> | ||
inline batch<T, N> ldexp(const batch<T, N>& x, const batch<as_integer_t<T>, N>& e) | ||
{ | ||
using btype = batch<T, N>; | ||
using itype = batch<as_integer_t<T>, N>; | ||
itype ik = e + itype(maxexponent<T>()); | ||
ik = ik << nmb<T>(); | ||
return x * bitwise_cast<btype>(ik); | ||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.