-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Bit-wise Left and Right shift (#361)
* implement bitshift * Added tests * Update changelog * Upd translate * Direct bind operation * manual inline
- Loading branch information
Showing
19 changed files
with
419 additions
and
114 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
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
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
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,35 @@ | ||
#include <ti/opr/oprinc.h> | ||
|
||
static int opr__sl(ti_val_t * a, ti_val_t ** b, ex_t * e) | ||
{ | ||
int64_t int_ = 0; /* set to 0 only to prevent warning */ | ||
ti_opr_perm_t perm = TI_OPR_PERM(a, *b); | ||
switch(perm) | ||
{ | ||
default: | ||
ex_set(e, EX_TYPE_ERROR, | ||
"bitwise `<<` not supported between `%s` and `%s`", | ||
ti_val_str(a), ti_val_str(*b)); | ||
return e->nr; | ||
|
||
case OPR_INT_INT: | ||
int_ = VINT(a) << VINT(*b); | ||
break; | ||
|
||
case OPR_INT_BOOL: | ||
int_ = VINT(a) << VBOOL(*b); | ||
break; | ||
|
||
case OPR_BOOL_INT: | ||
int_ = VBOOL(a) << VINT(*b); | ||
break; | ||
|
||
case OPR_BOOL_BOOL: | ||
int_ = VBOOL(a) << VBOOL(*b); | ||
break; | ||
|
||
} | ||
if (ti_val_make_int(b, int_)) | ||
ex_set_mem(e); | ||
return e->nr; | ||
} |
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,35 @@ | ||
#include <ti/opr/oprinc.h> | ||
|
||
static int opr__sr(ti_val_t * a, ti_val_t ** b, ex_t * e) | ||
{ | ||
int64_t int_ = 0; /* set to 0 only to prevent warning */ | ||
ti_opr_perm_t perm = TI_OPR_PERM(a, *b); | ||
switch(perm) | ||
{ | ||
default: | ||
ex_set(e, EX_TYPE_ERROR, | ||
"bitwise `>>` not supported between `%s` and `%s`", | ||
ti_val_str(a), ti_val_str(*b)); | ||
return e->nr; | ||
|
||
case OPR_INT_INT: | ||
int_ = VINT(a) >> VINT(*b); | ||
break; | ||
|
||
case OPR_INT_BOOL: | ||
int_ = VINT(a) >> VBOOL(*b); | ||
break; | ||
|
||
case OPR_BOOL_INT: | ||
int_ = VBOOL(a) >> VINT(*b); | ||
break; | ||
|
||
case OPR_BOOL_BOOL: | ||
int_ = VBOOL(a) >> VBOOL(*b); | ||
break; | ||
|
||
} | ||
if (ti_val_make_int(b, int_)) | ||
ex_set_mem(e); | ||
return e->nr; | ||
} |
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
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
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.