enhanced stix_inttostr() to handle a power-of-2 radix more efficiently
This commit is contained in:
		| @ -1256,6 +1256,23 @@ static int prim_integer_bitinv (stix_t* stix, stix_ooi_t nargs) | ||||
| 	return 1; | ||||
| } | ||||
|  | ||||
| static int prim_integer_bitshift (stix_t* stix, stix_ooi_t nargs) | ||||
| { | ||||
| 	stix_oop_t rcv, arg, res; | ||||
|  | ||||
| 	STIX_ASSERT (nargs == 1); | ||||
|  | ||||
| 	rcv = ACTIVE_STACK_GET(stix, stix->sp - 1); | ||||
| 	arg = ACTIVE_STACK_GET(stix, stix->sp); | ||||
|  | ||||
| 	res = stix_bitshiftint (stix, rcv, arg); | ||||
| 	if (!res) return (stix->errnum == STIX_EINVAL? 0: -1); /* soft or hard failure */ | ||||
|  | ||||
| 	ACTIVE_STACK_POP (stix); | ||||
| 	ACTIVE_STACK_SETTOP (stix, res); | ||||
| 	return 1; | ||||
| } | ||||
|  | ||||
| static int prim_integer_eq (stix_t* stix, stix_ooi_t nargs) | ||||
| { | ||||
| 	stix_oop_t rcv, arg; | ||||
| @ -1802,6 +1819,7 @@ static prim_t primitives[] = | ||||
| 	{   1,   prim_integer_bitor,        "_integer_bitor"       }, | ||||
| 	{   1,   prim_integer_bitxor,       "_integer_bitxor"      }, | ||||
| 	{   0,   prim_integer_bitinv,       "_integer_bitinv"      }, | ||||
| 	{   1,   prim_integer_bitshift,     "_integer_bitshift"      }, | ||||
| 	{   1,   prim_integer_eq,           "_integer_eq"          }, | ||||
| 	{   1,   prim_integer_ne,           "_integer_ne"          }, | ||||
| 	{   1,   prim_integer_lt,           "_integer_lt"          }, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user