filled stix_bitatint() a bit
This commit is contained in:
@ -1592,6 +1592,23 @@ stix_oop_t stix_bitatint (stix_t* stix, stix_oop_t x, stix_oop_t y)
|
||||
{
|
||||
if (STIX_OOP_IS_SMOOI(x) && STIX_OOP_IS_SMOOI(y))
|
||||
{
|
||||
stix_ooi_t v1, v2, v3;
|
||||
|
||||
v1 = STIX_OOP_TO_SMOOI(x);
|
||||
v2 = STIX_OOP_TO_SMOOI(y);
|
||||
|
||||
if (v2 <= 0) return STIX_SMOOI_TO_OOP(0);
|
||||
if (v1 >= 0)
|
||||
{
|
||||
if (v2 >= XXXXXXXXXX) return STIX_SMOOI_TO_OOP(0);
|
||||
v3 = ((stix_oow_t)v1 >> (v2 - 1)) & 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (v2 >= XXXXXXXXXX) return STIX_SMOOI_TO_OOP(-1);
|
||||
v3 = ((~(stix_oow_t)-v1 + 1) >> (v2 - 1)) & 1;
|
||||
}
|
||||
return STIX_SMOOI_TO_OOP(v3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1208,7 +1208,7 @@ static int prim_integer_bitat (stix_t* stix, stix_ooi_t nargs)
|
||||
{
|
||||
stix_oop_t rcv, arg, res;
|
||||
|
||||
STIX_ASSERT (nargs == 2);
|
||||
STIX_ASSERT (nargs == 1);
|
||||
|
||||
rcv = ACTIVE_STACK_GET(stix, stix->sp - 1);
|
||||
arg = ACTIVE_STACK_GET(stix, stix->sp);
|
||||
|
@ -58,11 +58,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if STIX_SIZEOF___INT128_T > 0
|
||||
# undef STIX_SIZEOF___INT128_T
|
||||
# define STIX_SIZEOF___INT128_T 0
|
||||
#endif
|
||||
|
||||
/* =========================================================================
|
||||
* PRIMITIVE TYPE DEFINTIONS
|
||||
* ========================================================================= */
|
||||
|
Reference in New Issue
Block a user