On Fri, Oct 14, 2016 at 05:03:39PM +0100, Chris Wilson wrote: > > We could try to future proof more maybe like > > sizeof(typeof(obj->base.size)), is typeof can be used like that? > > Something similar for sg API if possible. But then again, it could > > be better future proofing to be hardcoded like you wrote it. Yes I > > think so. > > I was just about to write it as obj->base.size, Let's compare! > > #define overflows_type(x, T) \ > (sizeof(x) < sizeof(T) && (x) > 1 << (sizeof(T) * BITS_PER_BYTE)) (sizeof(x) > sizeof(T) && ((x) >= 1 << (sizeof(T) * BITS_PER_BYTE))) > > if (overflows_type(size, obj->base.size) > > or > > if (overflows_type(size, size_t)) > > I think obj->base.size looks better from the self-documentation standpoint. > -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx