digitalmars.D.bugs - [Issue 19310] New: VRP for array casts
- d-bugmail puremagic.com (21/21) Oct 18 2018 https://issues.dlang.org/show_bug.cgi?id=19310
https://issues.dlang.org/show_bug.cgi?id=19310 Issue ID: 19310 Summary: VRP for array casts Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: performance Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dfj1esp02 sneakemail.com long[] f(byte[] a) { return cast(long[])a[0..a.length/8*8]; } Here the compiler can see that the array length is multiple of 8 and simply divide the length by 8 for the cast. --
Oct 18 2018