Forums

What data types / sizes supported by Cobra?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

What data types / sizes supported by Cobra?

Postby mlivingstone » Tue Jan 20, 2009 11:48 pm

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
mlivingstone
 
Posts: 3

Re: What data types / sizes supported by Cobra?

Postby jonathandavid » Wed Jan 21, 2009 2:03 am

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.
jonathandavid
 
Posts: 159

Re: What data types / sizes supported by Cobra?

Postby mlivingstone » Wed Jan 21, 2009 4:11 am

Hi jonathandavid,

That was just what I needed.

Thanks!

MarkL
mlivingstone
 
Posts: 3

Re: What data types / sizes supported by Cobra?

Postby Charles » Sun Feb 01, 2009 10:26 pm

I created a new wiki page on this topic called TypesOverview and I fleshed out StreamType. That should help quite a bit.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: What data types / sizes supported by Cobra?

Postby jonathandavid » Mon Feb 02, 2009 12:21 am

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?
jonathandavid
 
Posts: 159

Re: What data types / sizes supported by Cobra?

Postby Charles » Mon Feb 02, 2009 1:24 pm

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: What data types / sizes supported by Cobra?

Postby Charles » Tue Feb 03, 2009 7:48 pm

Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron