Improve SkAlign* to work with char* |
|||
Issue descriptionSkAlign* requires >> and << operators, which do not work on pointer types. As a result, we have to cast pointers to uintptr_t in order to align it. We should add support for working with char* to SkAlign*.
,
Sep 21 2016
Yes! Please try std::align. No need to wrap with a macro if it's clear enough without. We'd like Skia to use std:: when std:: does what we want.
,
Sep 21 2016
I agree in principle, but I'm not totally convinced std::align is what we want given its interface. In places where we use SkAlign?() I don't think we want to perform the alignment conditionally based on whether there is space for the size of the thing we're trying to store at the address. We usually know there is space before making the call.
,
Sep 21 2016
Yeah, I actually looked at std::align yesterday when quickly assessing the situation with SkAlign. The interface seems awkward and clumsy for our use case. I think our own templated helpers may be better?
,
Sep 21 2016
I agree, unfortunately. Last night I took a look at all of the SkAlign?() call sites to assess the fit. In all of our call sites we already know the buffer is large enough. So at best, it is a useless extra check. At medium, we would perhaps pipe the sizes in which might not be very natural. At worst, there is no buffer size like https://cs.chromium.org/chromium/src/third_party/skia/fuzz/fuzz.cpp?q=SkAlign&sq=package:chromium&l=284&dr=C and we just provide sizes of 1 and INT_MAX to force it. It would make things uglier.
,
Sep 25 2016
,
Jun 25 2018
This was fixed in https://skia-review.googlesource.com/c/skia/+/134331 |
|||
►
Sign in to add a comment |
|||
Comment 1 by cblume@chromium.org
, Sep 21 2016