Domain range checking for bitwise operators
Posted: 22 Apr 2021 1:20
I ran into an issue using the "~~" operator that I have distilled into a simple example question (VP10-64 bit):
In C++, I can do something like this:
In prolog I'm wondering if the following range checking is intended. Consider the following compiler error (or is this a domain issue?):
Thanks,
choibakk
In C++, I can do something like this:
Code: Select all
int main()
{
unsigned char v1 = 0xff;
unsigned char v2 = ~v1 + 0x1;
printf("%d\n", v2);
}
Code: Select all
hasDomain(unsigned8, V1),
hasDomain(unsigned8, V2),
V1 = 0xff,
V2 = ~~V1, % --> The value 4294967040 is out of the range [ 0 .. 255 ] for the domain 'core::unsigned8'
V3 = V2+1,
stdio::writef("%x\n", V3),
choibakk