1 /*******************************************************************************
2 Copyright (c) 2016, Michael Wallner <mike@php.net>.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
18 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *******************************************************************************/
26 #include "php_psi_stdinc.h"
31 static inline token_t
psi_calc_bin_lshift(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
85 case PSI_T_LONG_DOUBLE
:
134 case PSI_T_LONG_DOUBLE
:
144 res
->u64
= i1
.u64
<< i2
.u64
;
148 static inline token_t
psi_calc_bin_rshift(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
202 case PSI_T_LONG_DOUBLE
:
251 case PSI_T_LONG_DOUBLE
:
261 res
->u64
= i1
.u64
>> i2
.u64
;
265 static inline token_t
psi_calc_bin_and(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
319 case PSI_T_LONG_DOUBLE
:
368 case PSI_T_LONG_DOUBLE
:
378 res
->u64
= i1
.u64
& i2
.u64
;
382 static inline token_t
psi_calc_bin_xor(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
436 case PSI_T_LONG_DOUBLE
:
485 case PSI_T_LONG_DOUBLE
:
495 res
->u64
= i1
.u64
^ i2
.u64
;
499 static inline token_t
psi_calc_bin_or(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
553 case PSI_T_LONG_DOUBLE
:
602 case PSI_T_LONG_DOUBLE
:
612 res
->u64
= i1
.u64
| i2
.u64
;