Patch for CType

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

Patch for CType

Mathieu Suen-2
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

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

Re: Patch for CType

Paolo Bonzini-2
Applied, thanks.

Paolo

On Fri, Jun 10, 2011 at 11:07, Mathieu Suen <[hidden email]> wrote:

> 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
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-smalltalk
>
>

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