convert ubyte[k..k + 1] to int

Artur Skawina art.08.09 at gmail.com
Thu May 17 02:41:14 PDT 2012


On 05/17/12 11:36, Artur Skawina wrote:
>    assert(cast(size_t)data.ptr%data.alignof==0);
> 
> This assert can be easily triggered eg by doing
>    
>    blob[1..$-4]; blob.assumeSafeAppend(); ++blob.length;
>    auto data = cast(C[]) blob;

Umm, that was meant to be: 

    blob = blob[1..$-4]; blob.assumeSafeAppend(); ++blob.length;
    auto data = cast(C[]) blob;
    assert(cast(size_t)data.ptr%data.alignof==0);

artur


More information about the Digitalmars-d-learn mailing list