Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make P6{int,num} robust when bits key is absent on REPR composition.
  • Loading branch information
arnsholt committed Feb 2, 2013
1 parent 96581f1 commit 0048c0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/6model/reprs/P6int.c
Expand Up @@ -56,10 +56,9 @@ static void compose(PARROT_INTERP, STable *st, PMC *repr_info) {
if(!PMC_IS_NULL(integer)) {
/* TODO: Handle possible unsigned key. How to handle it though, since
* Parrot's INTVAL is inherently signed? */
/* XXX: I should probably handle the case where no "bits" key is set
* as well, which would set it to 0 (I think?). */
repr_data->bits = VTABLE_get_integer_keyed_str(interp, integer,
Parrot_str_new_constant(interp, "bits"));
if (!repr_data->bits) repr_data->bits = sizeof(INTVAL)*8;

if (repr_data->bits != 1 && repr_data->bits != 2 && repr_data->bits != 4
&& repr_data->bits != 8 && repr_data->bits != 16 && repr_data->bits != 32
Expand Down
3 changes: 1 addition & 2 deletions src/6model/reprs/P6num.c
Expand Up @@ -54,10 +54,9 @@ static void compose(PARROT_INTERP, STable *st, PMC *repr_info) {

repr_data->bits = sizeof(FLOATVAL)*8;
if(!PMC_IS_NULL(info)) {
/* XXX: I should probably handle the case where no "bits" key is set
* as well, which would set it to 0 (I think?). */
repr_data->bits = VTABLE_get_integer_keyed_str(interp, info,
Parrot_str_new_constant(interp, "bits"));
if (!repr_data->bits) repr_data->bits = sizeof(FLOATVAL)*8;

if(repr_data->bits != 32 && repr_data->bits != 64) {
die_bad_bits(interp);
Expand Down

0 comments on commit 0048c0e

Please sign in to comment.