[Glass] 32 bit Integers and OOP conversion.

Norm Green via Glass glass at lists.gemtalksystems.com
Wed Oct 25 09:06:36 PDT 2017


For 32 bit ints, you can do it like this in C :


static inline OopType int32ToOop(int arg)
{
   return (((OopType)arg << 3) | 2) ;
}

static inline unsigned int OopToInt32(OopType anOop) {
   return (int) (anOop >> 3);
}

Norm


On 10/25/2017 2:30 AM, gustav de ridder via Glass wrote:
> Hello
>
> I am writing an application using the Gembuilder for C API.
> I am using GemStone/S 64 Bit 3.3 GemBuilder for C and GemStone/S 64 
> Bit 3.3.3
>
> If possible, I'd like to be able to map an integer to its OOP (and 
> back) without a database round-trip.
>
> In gcioop.ht <http://gcioop.ht>, there is a macro GCI_I32_TO_OOP that 
> converts a 32bit C int to OopType using OOP_NUM_TAG_BITS and 
> OOP_TAG_SMALLINT.
> Can you identify all OopTypes that represent a SmallInteger in 
> gemstone using OOP_TAG_SMALLINT and reverse the operations to get an int?
>
> Regards
> Gustav
>
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20171025/25bee55d/attachment.html>


More information about the Glass mailing list