Martin Pelikan <[email protected]> napsal:
> I can't say anything more than 'this solved my problem', which was
>
> $ echo | awk '{ printf "%u\n", rshift(int("0xdeffffff"), 24) }' | bc -e
> 'obase=16'
> FFFFFF80
> vs.
> $ echo | awk '{ printf "%u\n", rshift(int("0xdeffffff"), 24) }' | bc -e
> 'obase=16'
> DE
>
> I hope it starts a discussion (at least), but I don't really know what
> the correct way is to these problems.
>
> --
> Martin Pelikan
>
Hello Martin,
You reached int boundary, so You received minimal number possible. I do not
think extending boundary is good solution (that way you will reach it soon
again).
To demonstrate:
$ awk 'BEGIN { printf("%d\n","0x7fffffff") }'
2147483647
$ awk 'BEGIN { printf("%d\n","0x80000000") }'
$ awk 'BEGIN { printf("%d\n","0x80000001") }'
$ awk 'BEGIN { printf("%d\n","0xffffffff") }'
$ awk 'BEGIN { printf("%d\n","0xfeedbeef") }'
$ awk 'BEGIN { printf("%d\n","0xfffffffffffff") }'
-2147483648
In my point of view, You should solve the problem elsehow. For example
splitting that big number to smaller or just trim last six characters (it
depends on problem you have)
Best regards
--
Jakub TuD
ek/otaznik <[email protected]>