Page 1 of 1

What data types / sizes supported by Cobra?

PostPosted: Tue Jan 20, 2009 11:48 pm
by mlivingstone
Hi Chuck,

I have trawled through your website and not found what I need in one place? If I have missed it, I apologise in advance ;-)

Do you have a page online that gives what data types and sizes Cobra supports? I want to play with some digital signature / encryption algorithms which means I need to know what size data types are for shifting, rotating etc.

Best Regards,

MarkL

Re: What data types / sizes supported by Cobra?

PostPosted: Wed Jan 21, 2009 2:03 am
by jonathandavid
Hi,

I'm not Chuck but until he replies maybe I can help.

Here is a list with all Cobra primitive types, and their supported operations (in addition to the usual operators):

http://cobra-language.com/trac/cobra/wiki/PrimitiveTypeMembers

You have versions of int where you can explicitly specifiy the number of bits (int8, int16, int32, int64), and of course their unsigned counterparts. If you just say int or uint, you get 32 bits

These are the equivalences between C# and Cobra integers:

C# Cobra
'byte': 'uint8',
'sbyte': 'int8',
'short': 'int16',
'ushort': 'uint16',
'int': 'int',
'long': 'int64',
'ulong': 'uint64',

If you need integers of arbitrary precision you can use any of the classes that are available for .NET. For example: http://www.carljohansen.co.uk/bigint/. For instructions on how to access C# code from Cobra, see this post.

Re: What data types / sizes supported by Cobra?

PostPosted: Wed Jan 21, 2009 4:11 am
by mlivingstone
Hi jonathandavid,

That was just what I needed.

Thanks!

MarkL

Re: What data types / sizes supported by Cobra?

PostPosted: Sun Feb 01, 2009 10:26 pm
by Charles
I created a new wiki page on this topic called TypesOverview and I fleshed out StreamType. That should help quite a bit.

Re: What data types / sizes supported by Cobra?

PostPosted: Mon Feb 02, 2009 12:21 am
by jonathandavid
Chuck wrote:I created a new wiki page on this topic called TypesOverview and I fleshed out StreamType. That should help quite a bit.



Thanks Chuck, this is a valuable addition. Don't you think something a little bit more explicit could be said in the "types overview" page about dynamic vars?

Re: What data types / sizes supported by Cobra?

PostPosted: Mon Feb 02, 2009 1:24 pm
by Charles
Well we could even break out a separate wiki page, right? If you need something right now, you can poke through the release notes going backwards and you'll find a section on the dynamic type. Also, check out the test cases.

Re: What data types / sizes supported by Cobra?

PostPosted: Tue Feb 03, 2009 7:48 pm
by Charles