• Heikki Linnakangas's avatar
    TYPEALIGN doesn't work on int64 on 32-bit platforms. · 5962519b
    Heikki Linnakangas authored
    The TYPEALIGN macro, and the related ones like MAXALIGN, don't work with
    values larger than intptr_t, because TYPEALIGN casts the argument to
    intptr_t to do the arithmetic. That's not a problem when dealing with
    pointers or lengths or offsets related to pointers, but the XLogInsert
    scaling patch added a call to MAXALIGN with an XLogRecPtr argument.
    
    To fix, add wider variants of the macros, called TYPEALIGN64 and MAXALIGN64,
    which are just like the existing variants but work with uint64 instead of
    intptr_t.
    
    Report and patch by David Rowley, analysis by Andres Freund.
    5962519b
c.h 30.3 KB