File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed
Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -66,13 +66,17 @@ func (v *Value) Release() {
6666// Assign go value to Sciter Value
6767// currently supported go types: bool integer float string and NativeFunctor
6868func (v * Value ) Assign (val interface {}) {
69+ const is64Bit = uint64 (^ uintptr (0 )) == ^ uint64 (0 )
6970 switch val .(type ) {
7071 case string :
7172 s := val .(string )
7273 v .SetString (s )
73- case int :
74- i := val .(int )
74+ case int32 :
75+ i := val .(int32 )
7576 v .SetInt (i )
77+ case int64 :
78+ i := val .(int64 )
79+ v .SetInt64 (i )
7680 case float64 :
7781 f := val .(float64 )
7882 // valueInit(this); valueFloatDataSet(this, v, T_FLOAT, 0)
@@ -86,16 +90,22 @@ func (v *Value) Assign(val interface{}) {
8690 v .SetInt (i )
8791 case float32 :
8892 v .Assign (float64 (val .(float32 )))
93+ case int :
94+ if is64Bit {
95+ v .Assign (int64 (val .(int )))
96+ } else {
97+ v .Assign (int32 (val .(int )))
98+ }
8999 case uint :
90- v .Assign (int (val .(uint )))
100+ if is64Bit {
101+ v .Assign (uint64 (val .(uint )))
102+ } else {
103+ v .Assign (uint32 (val .(uint )))
104+ }
91105 case uint32 :
92- v .Assign (int (val .(uint32 )))
106+ v .Assign (int32 (val .(uint32 )))
93107 case uint64 :
94- v .Assign (int (val .(uint64 )))
95- case int32 :
96- v .Assign (int (val .(int32 )))
97- case int64 :
98- v .Assign (int (val .(int64 )))
108+ v .Assign (int64 (val .(uint64 )))
99109 case Value :
100110 vf := val .(Value )
101111 v .Copy (& vf )
You can’t perform that action at this time.
0 commit comments