cinetec_tech Posted September 23, 2014 Posted September 23, 2014 it seems the long type in uniginescript should be equal to long long type in c++. long x=pow(2,32); log.message("%016lx\n",x); //wrong log.message("%016llx\n",x); //correct
cinetec_tech Posted September 24, 2014 Author Posted September 24, 2014 After i play around with long type in uniginescript. i found the following issue 1:assign issue. if i assign long this way (same as 0x4000000000000000) long mask=4611686018427387904; log.message("mask:%016llx\n",mask); result:the print value is 0 the only way to assign long is long mask=long("0x4000000000000000"); 2:if issue: with above code if(mask & (1l << 62))) will always be skipped even the result is not 0 way to use if if((mask & (1l << 62))!=0) are those behavior correct?
silent Posted September 24, 2014 Posted September 24, 2014 Hello, You should add "L" or "l" to your number. For example: long mask = 4611686018427387904L; if((mask & (1l << 62)) !=0) is correct way to check the results of bitwise and operator if you are using long. Also, you can use more strict check: long mask = long("0x710fffffffffffff"); long check = long("0x0100000000000000"); if(check != 0 && (mask & check) == check) { //not skipped } Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts