Permalink
Browse files

Efficiency improvements

  • Loading branch information...
mattrajca committed Dec 12, 2010
1 parent ac6c417 commit 8ba9b2866f082c7f67e6b522805079222ba0fdcf
Showing with 8 additions and 12 deletions.
  1. +4 −6 src/pmc/nummatrix2d.pmc
  2. +4 −6 t/pmc/nummatrix2d.t
View
@@ -442,9 +442,8 @@ must have two elements.
}
VTABLE void set_string_keyed(PMC * key, STRING * value) {
PMC * const item = get_external_pmc(INTERP, enum_class_Float);
VTABLE_set_string_native(INTERP, item, value);
VTABLE_set_pmc_keyed(INTERP, SELF, key, item);
const FLOATVAL v = Parrot_str_to_num(INTERP, value);
VTABLE_set_number_keyed(INTERP, SELF, key, v);
}
VTABLE void set_pmc_keyed(PMC * key, PMC * value) {
@@ -511,9 +510,8 @@ Convert the string to a Complex PMC, and set that at the specified location.
}
VTABLE void set_string_keyed_int(INTVAL key, STRING * value) {
PMC * const item = get_external_pmc(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, item, value);
VTABLE_set_pmc_keyed_int(INTERP, SELF, key, item);
const FLOATVAL v = Parrot_str_to_num(INTERP, value);
VTABLE_set_number_keyed_int(INTERP, SELF, key, v);
}
View
@@ -238,13 +238,12 @@ method test_VTABLE_set_string_keyed() {
my $a;
Q:PIR {
$P0 = find_lex "$m"
$S0 = "15.0"
$P0[0;0] = $S0
$P0[0;0] = "15.2"
$N1 = $P0[0;0]
$P1 = box $N1
store_lex "$a", $P1
};
assert_equal($a, 15.0, "set_string_key failed");
assert_equal($a, 15.2, "set_string_key failed");
}
method test_VTABLE_set_string_keyed_int() {
@@ -254,12 +253,11 @@ method test_VTABLE_set_string_keyed_int() {
my $a;
Q:PIR {
$P0 = find_lex "$m"
$S0 = "15.0"
$P0[0] = $S0
$P0[0] = "15.2"
$N1 = $P0[0]
$P1 = box $N1
store_lex "$a", $P1
};
assert_equal($a, 15.0, "set_string_key_int failed");
assert_equal($a, 15.2, "set_string_key_int failed");
}

0 comments on commit 8ba9b28

Please sign in to comment.