[Bf-committers] seq_hash_render_data() includes undefined results due to out of range bitshift

Chad Fraleigh chadf at triularity.org
Thu Aug 6 07:43:49 CEST 2015


The hash function seq_hash_render_data() in
blender/source/blender/blenkernel/intern/seqcache.c includes a value
shifted 32 bits for a 32-bit int.

static unsigned int seq_hash_render_data(const SeqRenderData *a)
{
    unsigned int rval = a->rectx + a->recty;

. . .

    rval ^= ((a->scene->r.views_format * 2) + a->view_id) << 32;

    return rval;
}


Compile warning given by VS 2013:

warning C4293: '<<' : shift count negative or too big, undefined
behavior    .......\blender\source\blender\blenkernel\intern\seqcache.c

That part of the value could be removed (since it may currently be a no-op)
or changed to a lower shift value (e.g. << 28).


-Chad


More information about the Bf-committers mailing list