o1i already provided an excellent reply to this
I C you should replace ULONG with uint32 or uint64 as defined in /usr/include/x86_64-linux-gnu/bits/types.h and recommended in the AmigaOS SDK documentation in https://wiki.amigaos.net/wiki/Migration_Guide#Type_Consistency .
... but wanted to add by writing that by differentiating between these two types it would just makes matters worse. The whole point of the issues when porting is tht the 32-bit software uses a 32 bit specific type in order to f.e. use pointermath and which does not hold up when compiled for 64-bit.
One could argue this is a oversight from the (original) programmer (but to be fair at that point in time there probably wasn't any 64-bit future) and simply takes a lot of time to go over the source-code and detect these pitfalls (and which then need to be addressed).
Would you stick to differentiating between 32/64 bit types then you would have to either use a macro (that eventually leads to) or make use of conditional compilation in order to solve that.
Using an APTR or IPTR right from the start will make sure the actual type size will change automatically according to the bitness it was compiled for. That way no (other) source-related changes are needed. If there was to be a 128-bit AROS target then such fixed source-code would also work for this new bitness (provided no other pitfalls comes provided by using a new 128-bit target, alignment comes to mind).