[dmd-internals] [D-Programming-Language/dmd] 5bea01: fix Issue 12780 - Multiplying integer array by sca...

GitHub via dmd-internals dmd-internals at puremagic.com
Fri Dec 26 23:39:42 PST 2014


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/dmd
  Commit: 5bea0130e4d3491dfcae1501f8248b478fb5e8ae
      https://github.com/D-Programming-Language/dmd/commit/5bea0130e4d3491dfcae1501f8248b478fb5e8ae
  Author: k-hara <k.hara.pg at gmail.com>
  Date:   2014-12-19 (Fri, 19 Dec 2014)

  Changed paths:
    M src/arrayop.c
    M src/cast.c
    M test/runnable/arrayop.d

  Log Message:
  -----------
  fix Issue 12780 - Multiplying integer array by scalar double fails

Support upcasting slice elements in array operations.

1. The tweak in the buildArrayIdent() retains backward compatibility.
a) If no element upcasting exists in array operation, the generated function name is not changed.
  double_res[] = double_val * double_arr[];
  // _arrayExpSliceMulSliceAssign_d
b) If upcasting slice elements is necessary, it will be encoded by the postfix "Of" + element-type-deco
  double_res[] = double_val * int_arr[];
  // _arrayExpSlice'Ofi'MulSliceAssign_d

2. Even if the whole array operation requires double element, the sub array operations can be processed by int.
  double_res[] = (int_val ^ int_arr[]) * double_val;
  // typeof(int_val ^ int_arr[]) == int[]


  Commit: 22611aa7eda98705a5661f0df424434a73b3c837
      https://github.com/D-Programming-Language/dmd/commit/22611aa7eda98705a5661f0df424434a73b3c837
  Author: Daniel Murphy <yebblies at gmail.com>
  Date:   2014-12-27 (Sat, 27 Dec 2014)

  Changed paths:
    M src/arrayop.c
    M src/cast.c
    M test/runnable/arrayop.d

  Log Message:
  -----------
  Merge pull request #4218 from 9rnsr/fix12780

Issue 12780 - Multiplying integer array by scalar double fails


Compare: https://github.com/D-Programming-Language/dmd/compare/5d6db2edc196...22611aa7eda9


More information about the dmd-internals mailing list