Fix for CType

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix for CType

Mathieu Suen-2
Hi Paolo


I have made a patch for CType comparaison.
Commit: 92b24ab42101800bbd86
You can fetch it from:
git://github.com/mathk/smalltalk.git


@@ -135,6 +135,17 @@ elements.'>
   structureType == #array ifTrue: [^CArrayCType from: type].
   structureType == #ptr ifTrue: [^CPtrCType from: type]
     ]
+    
+    = anObject [
+  ^self class == anObject class and: [
+      self cObjectType = anObject cObjectType
+  ]
+
+    ]
+
+    hash [
+  ^self cObjectType hash bitXor: self cObjectType hash
+    ]

     gcNew [
   "Allocate a new CObject with the type (class) identified by the receiver.


        Mth





_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Fix for CType

Paolo Bonzini-2
On 05/12/2011 08:07 AM, Mathieu Suen wrote:

>       ]
> +
> +    = anObject [
> +  ^self class == anObject class and: [
> +      self cObjectType = anObject cObjectType
> +  ]
> +
> +    ]
> +
> +    hash [
> +  ^self cObjectType hash bitXor: self cObjectType hash
> +    ]
>

There is a typo (the first "cObjectType" should be "class").  Also, you
should add equality/hash implementations for CPtrCType and CArrayCType.

Thanks!

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk