mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add shift_left<N> and shift_right<N> coefficient-wise unary Array functions
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
54aa8fa186
commit
232f904082
@@ -25,7 +25,7 @@ pfrexp_float(const Packet& a, Packet& exponent) {
|
||||
const Packet cst_126f = pset1<Packet>(126.0f);
|
||||
const Packet cst_half = pset1<Packet>(0.5f);
|
||||
const Packet cst_inv_mant_mask = pset1frombits<Packet>(~0x7f800000u);
|
||||
exponent = psub(pcast<PacketI,Packet>(pshiftright<23>(preinterpret<PacketI>(a))), cst_126f);
|
||||
exponent = psub(pcast<PacketI,Packet>(plogical_shift_right<23>(preinterpret<PacketI>(a))), cst_126f);
|
||||
return por(pand(a, cst_inv_mant_mask), cst_half);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ pldexp_float(Packet a, Packet exponent)
|
||||
const Packet cst_127 = pset1<Packet>(127.f);
|
||||
// return a * 2^exponent
|
||||
PacketI ei = pcast<Packet,PacketI>(padd(exponent, cst_127));
|
||||
return pmul(a, preinterpret<Packet>(pshiftleft<23>(ei)));
|
||||
return pmul(a, preinterpret<Packet>(plogical_shift_left<23>(ei)));
|
||||
}
|
||||
|
||||
// Natural logarithm
|
||||
@@ -466,8 +466,8 @@ Packet psincos_float(const Packet& _x)
|
||||
// Compute the sign to apply to the polynomial.
|
||||
// sin: sign = second_bit(y_int) xor signbit(_x)
|
||||
// cos: sign = second_bit(y_int+1)
|
||||
Packet sign_bit = ComputeSine ? pxor(_x, preinterpret<Packet>(pshiftleft<30>(y_int)))
|
||||
: preinterpret<Packet>(pshiftleft<30>(padd(y_int,csti_1)));
|
||||
Packet sign_bit = ComputeSine ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int)))
|
||||
: preinterpret<Packet>(plogical_shift_left<30>(padd(y_int,csti_1)));
|
||||
sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit
|
||||
|
||||
// Get the polynomial selection mask from the second bit of y_int
|
||||
|
||||
Reference in New Issue
Block a user