|
-
Feb 5th, 2002, 07:47 AM
#1
Thread Starter
Fanatic Member
Hi Nibble
Once apon a time along time ago I was introduced to a technique called hi-nibble/lo-nibble. Back then I was a pascal newbie trying hard to pass GCSEs.
The principle was simple useing (128 I think) and some maths function one could take the first two parts of a string and store them in one byte. High and low!!
The problem is now that I have a usefull function for this fella I can't remember it.
If anyone has any idea what I am on about please help.
-
Feb 5th, 2002, 10:46 AM
#2
I believe it was called Endian Encoding. I've seen it used in
applications that require the storage of relative large amounts of
character data in a smaller space. The one I remember most was
a program called NUTS that was used to analyze Nuclear
Magnetic Resonance images.
Essentially, the first 4 nibbles of the byte refer to the first of a
hex value, the second refers to the second byte of the hex
value. It's a two for one saving.
The decoding function went something like this:
(Character and 240)*256 + (character and 15) = Decimal Value
Not too much application, tho.....
-
Feb 5th, 2002, 04:51 PM
#3
Frenzied Member
In general, one cannot store the information about two 8-bit bytes in one 8-bit byte.
Due to the nature of certain files, there are compression schemes which will encode a file so that it can be stored in less than half the space required for the original file. WinZip will do this.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Feb 5th, 2002, 04:53 PM
#4
Thread Starter
Fanatic Member
I knew it!!!!
Thankyou. If you could put up with me a little longer how can I apply that formula (is that for in or out) it's been a while since I had to rearrange an equation.
Thanks again.
-
Feb 6th, 2002, 12:16 PM
#5
ummmm...I think I mis-spoke.
The process I was thinking of is a way of encoding numbers in a
text file, at least the endian process used by Nuts.
is an example of the ecoding. Each character represents a value
that would take 4 or 5 characters to represent in text format.
http://www.acornnmr.com/NutsHelp/cdff.html#3
is the page describing the file that uses it. the quote above
comes after the verbiage....
Sorry.
Guv was right....as usual.
-
Mar 27th, 2002, 09:45 PM
#6
Thread Starter
Fanatic Member
Ok, thanx anyway.
I guess me old memory didn't do the lesson justice.
ta' for your time.
[edit]
That was one very old and long time ago lesson
[/edit]
Last edited by Matt_T_hat; Mar 31st, 2002 at 08:30 AM.
-
Mar 31st, 2002, 05:46 AM
#7
Correct!!
By gov:
In general, one cannot store the information about two 8-bit bytes in one 8-bit byte.
It seems that many people think it is possible to do so, and try to make programs making this possible.
Whatever happens, you can't!! There is no way you can make a 'zipping program' that will always compress files. There is just no possible way of making 2^n combinations (using n BITs), and converting them to 2 ^ n-1 combinations using one method, such that all of the 2^n can be compressed. The only thing you can do is rearrange/alter the already used n BITs.
Also, there is a simple way of writing numbers to files so that the file size is smaller.
All you have to do is split the number into 2-digit blocks, the save chr$(2-digit + 65). This is so that the 'nasty' low down CHR$() things, such as new-line, clear screen etc. are not included.
Finally, for ultimate minimization of numbers, convert the whole thing into a binary strain, with each block of 4 (3 only gives numbers 0 - 7) standing for each digit. This is kind of like what someone else was saying. (NOte, this doen't always work, sometimes you get bigger files)
-
Apr 2nd, 2002, 10:23 AM
#8
New Member
Correct!
By gov:
In general, one cannot store the information about two 8-bit bytes in one 8-bit byte.
there is a simple way of writing numbers to files so that the file size is smaller.
save the file as binary instead of text .
-
Apr 9th, 2002, 11:22 AM
#9
Thread Starter
Fanatic Member
I feel a little foolish.
Twas searching 4 a way to make my files hard to read for storing midly sensitive data in.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|