src/prog/analysis/maths.for: 64-bit bugfix

I'm not sure how this ever actually worked in 64-bit mode -- a ptrdiff buffer
offset was being used but memalloc/memfree were being called instead of
memallop/memfrep, and an int variable 'idx' was being set to the ptrdiff 'pnt'
value. Anyway, this patch fixes a recently-observed crash on 64-bit Macs.