help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Patch for CType


From: Mathieu Suen
Subject: [Help-smalltalk] Patch for CType
Date: Fri, 10 Jun 2011 10:07:50 +0100 (BST)

Hi Paolo

Just a reminder for the CType patch here is the info:

https://github.com/mathk/smalltalk/commit/7ba2d5421c51198736806e75965d114f8c857dd6

https://github.com/mathk/smalltalk/commit/49a140f84c3324f6f1c0e6ca6f8abab8dbed6447

https://github.com/mathk/smalltalk/commit/92b24ab42101800bbd8653cca28a357be45d5f4f


Full patch:
diff --git a/kernel/CType.st b/kernel/CType.st
index bd2a01e..8c570a6 100644
--- a/kernel/CType.st
+++ b/kernel/CType.st
@@ -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 class hash bitXor: self cObjectType hash
+    ]

     gcNew [
        "Allocate a new CObject with the type (class) identified by the 
receiver.
@@ -319,6 +330,14 @@ CType subclass: CPtrCType [
            yourself
     ]

+    = anObject [
+       ^super = anObject and: [self elementType = anObject elementType]
+    ]
+
+    hash [
+       ^super hash bitXor: self elementType hash
+    ]
+
     elementType [
        "Answer the type of the elements in the receiver's instances"

@@ -379,6 +398,14 @@ CPtrCType subclass: CArrayCType [
            yourself
     ]

+    = anObject [
+       ^super = anObject and: [self numberOfElements = anObject 
numberOfElements]
+    ]
+
+    hash [
+       ^super hash bitXor: self numberOfElements.
+    ]
+
     storeOn: aStream [
        "As with super."
        <category: 'storing'>


Thanks

--
Mathieu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]