[Issue 19310] New: VRP for array casts
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Oct 18 09:47:47 UTC 2018
    
    
  
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 at puremagic.com
          Reporter: dfj1esp02 at 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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list