Skip to content

Commit

Permalink
fix a bug I introduced into vtable clone
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Jun 21, 2010
1 parent 73d4f09 commit 9e91f42
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/pmc/nummatrix2d.pmc
Expand Up @@ -330,6 +330,10 @@ pmclass NumMatrix2D dynpmc auto_attrs provides matrix {

=item* add

=item* add_float

=item* add_int

=cut

*/
Expand Down Expand Up @@ -362,6 +366,18 @@ pmclass NumMatrix2D dynpmc auto_attrs provides matrix {
return dest;
}

PMC *add_float(FLOATVAL v, PMC *dest) {
dest = VTABLE_clone(INTERP, SELF);
add_scalar_float(INTERP, dest, v);
return dest;
}

PMC *add_int(INTVAL v, PMC *dest) {
dest = VTABLE_clone(INTERP, SELF);
add_scalar_float(INTERP, dest, (FLOATVAL)v);
return dest;
}

/*

=item* multiply
Expand Down Expand Up @@ -522,8 +538,8 @@ pmclass NumMatrix2D dynpmc auto_attrs provides matrix {
INTVAL const newsize = rows_size * cols_size;
FLOATVAL * const old_s = old_atts->storage;
FLOATVAL * const new_s = ALLOCATE_STORAGE(newsize);
memcpy(new_s, old_s, newsize);
memcpy(new_attrs, old_atts, sizeof(Parrot_NumMatrix2D_attributes));
memcpy(new_s, old_s, newsize * sizeof(FLOATVAL));
memcpy(new_atts, old_atts, sizeof(Parrot_NumMatrix2D_attributes));
new_atts->storage = new_s;
return c;
}
Expand Down

0 comments on commit 9e91f42

Please sign in to comment.