(Cancel and replace previous emails on issue #647)

On 14/06/2012 23:28, Thomas Girard wrote:
>> I will also make this available as a pull request on github, along with
>> another cosmetic change. 
> 
> That's:
>   https://github.com/bonzini/smalltalk/pull/5

The issue also existed on CULong. Reworked patch attached.

Regards,

Thomas
fix issue #647

2012-06-14  Thomas Girard  <[email protected]>

	* libgst/cint.c: Add missing size for long long and
	unsigned long long types to _gst_c_type_size.
	* libgst/dict.inl: Add IS_C_LONGLONG and IS_C_ULONGLONG macros.
	* libgst/prims.def: Use these macros in VMpr_CObject_atPut.
	Add missing test for unsigned long in VMpr_CObject_atPut.
diff --git a/libgst/cint.c b/libgst/cint.c
index ce5455a..77c8f8c 100644
--- a/libgst/cint.c
+++ b/libgst/cint.c
@@ -749,6 +749,11 @@ _gst_c_type_size (int type)
     case CDATA_ULONG:
       return sizeof (unsigned long);
 
+    case CDATA_LONGLONG:
+      return sizeof (long long);
+    case CDATA_ULONGLONG:
+      return sizeof (unsigned long long);
+
     case CDATA_FLOAT:
       return sizeof (float);
     case CDATA_DOUBLE:
diff --git a/libgst/dict.inl b/libgst/dict.inl
index bafdb11..e4dfe7d 100644
--- a/libgst/dict.inl
+++ b/libgst/dict.inl
@@ -274,6 +274,8 @@ static inline uint64_t to_c_uint_64 (OOP oop);
 
 #define TO_C_INT(integer)	to_c_int_32(integer)
 #define IS_C_INT(oop)		is_c_int_32(oop)
+#define IS_C_LONGLONG(oop)	is_c_int_64(oop)
+#define IS_C_ULONGLONG(oop)	is_c_uint_64(oop)
 #define FROM_C_LONGLONG(integ)	from_c_int_64(integ)
 #define FROM_C_ULONGLONG(integ)	from_c_uint_64(integ)
 
diff --git a/libgst/prims.def b/libgst/prims.def
index eda1650..ecfbed5 100644
--- a/libgst/prims.def
+++ b/libgst/prims.def
@@ -3794,9 +3794,9 @@ primitive VMpr_Memory_atPut [succeed,fail]
 	      PRIM_SUCCEEDED;
 	    }
 	  break;
-       case CDATA_LONGLONG:            /* long */
-       case CDATA_ULONGLONG:           /* unsigned long */
-         if (is_c_int_64 (oop4) || is_c_uint_64 (oop4))
+       case CDATA_LONGLONG:            /* long long */
+       case CDATA_ULONGLONG:           /* unsigned long long */
+         if (IS_C_LONGLONG (oop4) || IS_C_ULONGLONG (oop4))
            {
              *(long long *) arg2 = to_c_int_64 (oop4);
              PRIM_SUCCEEDED;
@@ -4851,16 +4851,16 @@ primitive VMpr_CObject_atPut [succeed,fail]
 
 	case CDATA_LONG:		/* long */
 	case CDATA_ULONG:		/* ulong */
-	  if (IS_C_LONG (oop3))
+	  if (IS_C_LONG (oop3) || IS_C_ULONG (oop3))
 	    {
 	      *(long *) addr = (long) TO_C_LONG (oop3);
 	      PRIM_SUCCEEDED;
 	    }
 	  break;
 
-       case CDATA_LONGLONG:            /* long */
-       case CDATA_ULONGLONG:           /* ulong */
-         if (IS_C_LONG (oop3))
+       case CDATA_LONGLONG:            /* long long */
+       case CDATA_ULONGLONG:           /* unsigned long long */
+         if (IS_C_LONGLONG (oop3) || IS_C_ULONGLONG (oop3))
            {
              *(long long *) addr = (long long) to_c_int_64 (oop3);
              PRIM_SUCCEEDED;
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to