HaxeFoundation / HaxeFoundation/haxe
isInt64 is true for Int value on cpp
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
trace(haxe.Int64.isInt64(100));
```
This code traces `true`, when compiled to cpp with haxe 4.1.4.
On js it is false.
The code that finally checks the type is in `hxcpp/include/cpp/Int64.h`
```cpp
StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
hx::Object *obj = params->inData;
int type = obj->__GetType();
params->outProcessed = type==vtInt || type==vtInt64;
```
And it actually returns true if value is `Int`.
As a workaround I'm using this code:
```haxe
public static function isInt64(v: Dynamic): Bool {
return Type.typeof(v) != TInt && Int64.is(v);
}
```
It works in most cases, but returns `false` for Int64 values in range [-1...255] (including both 1 and 255). But that's not a problem in my case.
Contributor guide
Assessment
This issue has not been assessed yet.