Read & Write Encoded Integers

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Read & Write Encoded Integers

Post by kawasaki »

Hey All,

Encoded Integers (Described below) I believe would be a good addition to PureBasic, because it will add that little bit extra to it becoming on parr with the more commercialised programming languages.
Encoded Integers

An ENCINT is a variable-length integer. The high bit of each byte indicates "continued to the next byte". Bytes are stored most significant to least significant. So, for example, $EA $15 is (((0xEA&0x7F)<<7)|0x15) = 0x3515.

- "Microsoft's HTML Help (.chm) format" by Matthew T. Russotto
Thanks,


Mike
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Read & Write Encoded Integers

Post by Little John »

kawasaki wrote:Encoded Integers (Described below) I believe would be a good addition to PureBasic, because it will add that little bit extra to it becoming on parr with the more commercialised programming languages.
Which are the "more commercialised programming languages" you are thinking of?

Regards, Little John
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post by kawasaki »

Hey,

The more major candidates for commercialised programming languages in my oppinion, obviously are C, C# and C++. Not necessarily commercialised, but more flexible.

Since there are cases out there (such as the CHM format) that uses the Encoded Integer, it would just be nice to have the Encoded Integer in the File I/O commands.


Thanks,

Mike
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

This is the first time i hear of such a number format. Just because one file format uses it does not justify adding extra commands to the language.

Besides, it sounds like a fairly simple format. Some bitshifting and arithmetic operations should do the trick to read/write it.
quidquid Latine dictum sit altum videtur
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

freak wrote:This is the first time i hear of such a number format.
used sometimes in packing/codecs algos .
SPAMINATOR NR.1
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

kawasaki wrote:The more major candidates for commercialised programming languages in my oppinion, obviously are C, C# and C++.
And these programming languages do support ENCINT variables?

Regards, Little John
Post Reply