On Mon, 25 Feb 2013 12:09:24 -0600, Paul Gilmartin <[email protected]> wrote:
>On Mon, 25 Feb 2013 11:49:59 -0600, John McKown wrote:
>
>>Depends on the contents of register 11. B040 will be quad word aligned only
>>if register 11 is itself quad word aligned. If you got this from a STORAGE
>>OBTAIN or GETMAIN, then the alignment is only guaranteed to be double word
>>aligned, unless you ask for it to be page aligned.
>>
>My earlier suggestion was wretchedly non-reentrant.
>
>OK. So OBTAIN 16 more bytes than needed.
>
>Use modulo arithmetic to point to the first quadword boundary there.
>Save the original address from OBTAIN in order to free the block.
>
If the address is guaranteed to be double word aligned, you only need to obtain
8 more bytes than needed.
The arithmetic for pointing to the first quadword boundary can be done as
follows:
LA R15,SEG+8
N R15,=A(X'FFFFFFF0')
CDSG R4,R2,0(R15)
SEG DS 3D
I don't think of it as modulo arithmetic, but the result is the same.
Bill
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN