Click to See Complete Forum and Search --> : Hi Nibble
Matt_T_hat
Feb 5th, 2002, 06:47 AM
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.
DerFarm
Feb 5th, 2002, 09:46 AM
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.....
Guv
Feb 5th, 2002, 03:51 PM
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.
Matt_T_hat
Feb 5th, 2002, 03:53 PM
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.
DerFarm
Feb 6th, 2002, 11:16 AM
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.
KR5RKX&J1LK
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.:rolleyes:
Guv was right....as usual.
Matt_T_hat
Mar 27th, 2002, 08:45 PM
Ok, thanx anyway.
I guess me old memory didn't do the lesson justice.
ta' for your time.
That was one very old and long time ago lesson
sql_lall
Mar 31st, 2002, 04:46 AM
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)
sql_loll
Apr 2nd, 2002, 09:23 AM
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 :cool:.
Matt_T_hat
Apr 9th, 2002, 11:22 AM
:rolleyes: I feel a little foolish.
Twas searching 4 a way to make my files hard to read for storing midly sensitive data in.
:(
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.