http://qs1969.pair.com?node_id=11108838


in reply to Re^5: Can I access and use UV types from perl?
in thread Can I access and use UV types from perl?

Yes the image helped, I can see from that that perhaps this is what happens. To calculate a two's complement number take the difference of the highbit masked number, with the complement mask of the highbit number. The number being negative when the highbit is set, essentially saying complement mask minus the highbit mask number.

We could use pairs of numbers, such that the 'highbit' could be any binary number and the difference found between that and its pair then resolves into an integer. It's a different way of storing and operating on the numbers.

update added example code

=head1 polynumber binary pairs (bifields?) 0 00_00 -1 1 00_01 01_00 -2 2 00_10 10_00 -3 3 00_11 11_00 =cut

But, we get overlaps.

=head1 polynumber binary pairs (bifields?) overlaps 1 -2 10_01 01_10 -1 1 01_10 10_01 -3 0 00_11 11_11 =cut

note: row polynumbers are read opposite significant highbit first. That is, if these are 'N'etwork order they should be read 'V'ax order. This illustrates the concept.

edit added whitespace, and note