Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Bits

Name: Anonymous 2011-12-05 17:33

Hi /prog/rammers...

I'm an hobby programmer and I'm here to ask a really simple question... I tried to google it but I don't even know where to start my search

the notation:
0x00 = 00000000
how it is called?
how can I convert an 8bit array in this form?
for example how can I discover the notation or the bit pattern?
?? = 00110100
0xff = ??

can someone explain me the logic behind?

thank you...

Name: Anonymous 2011-12-05 17:39

Go read the hexadecimal article on this obscure, not widely known site:
http://en.wikipedia.org/wiki/Hexadecimal

Name: Anonymous 2011-12-05 17:41

Really? Well, the question is a bit... elementary, but it seems no troll so I'll answer.

It's a commonly used notation for 'hexadecimal' numbers, which is what you call any number written in base-16.

Look up numeric bases and conversion from one base to another. Decimal, octal, binary and hexadecimal are all just convenient and commonly used numerical bases.

Name: Anonymous 2011-12-05 18:01

yes is elementary... but although I understand a bit of "high level programming" this notation seems a bit obscure to me...

I never had a programming lecture... I swear... even though I could make this: http://www.youtube.com/watch?v=8IUnqm8j4BE

But anyway thx!

so just to be clear:
10 = 0xa = 00001010

is this right?

Name: Anonymous 2011-12-05 18:07

>>4
that's true, but the which representation of numbers you use holds no impact on programming whatsoever

Name: Anonymous 2011-12-05 18:22

>>5
I'm trying to learn OpenGL... and in a tutorial I found "the Addison" the talk about bitmaps, and I would like to draw something with bitmaps!

Name: Anonymous 2011-12-05 18:43

0-15 = 0 1 2 3 4 5 6 7 8 9 A B C D E F

To convert, take successive blocks of 4 bits from the end of the string (b1, b2, b3, b4) -- the hex value is b4 + b3 * 2 + b2 * 4 + b1 * 8, look this number up in the table above and replace with hex character.

Name: Anonymous 2011-12-05 18:45

>>6
Try learning atleast some basic C before you go into OpenGL
if you have time to take it slow
Also try NeHe's OpenGL tutorial, it's old but still pretty relevant and noob friendly(except for reading textures from .bmp with that obsolete lib)

Name: Anonymous 2011-12-05 19:38

>>1

Numbers can be represented textually in a variety of forms. The most common used system is the positional notation, using the base ten. However, one can devise a positional notation for numbers in any particular numeric base, using any set of symbols to represent the digits (which is a concept particularly bound to this notation). In computing, it is also pretty common to use the base two (popularly called "binary"), base eight ("octal") and base sixteen ("hexadecimal"). These bases are interesting because they relate directly to the electronic signals which represents the numbers themselves (the "bits"). Roughly speaking, a binary digit is equivalent to a single bit, whereas an octal digit is equivalent to three bits, and an hexadecimal digit is equivalent to four bits.

Now, the 0 and 0x prefixing a number is present only to allow lexical scanners to quickly identify the base in which a (possibly ambiguous) string representing such number is written. These prefixes do not take part on the number itself. In some languages, like VHDL, one can explicitly tell the base in which a number is encoded textually, for example #13#12281A0#.

To convert between numeric bases in the positional system, there are tons of articles online explaining the process.

Name: Anonymous 2011-12-05 19:43

>>7
I did a small converter in python (before seeing your post):

dicthex_bin = {
"0":"0000",
"1":"0001",
"2":"0010",
"3":"0011",
"4":"0100",
"5":"0101",
"6":"0110",
"7":"0111",
"8":"1000",
"9":"1001",
"A":"1010",
"B":"1011",
"C":"1100",
"D":"1101",
"E":"1110",
"F":"1111"
}

dictbin_hex = dict((v,k) for k, v in dicthex_bin.iteritems())

def hex_to_binary(hex_str):
    bin = ""
    for letter in hex_str:
        bin += dicthex_bin[letter]
    return bin



>>8
maybe relevant to your "learn C basics":
http://www.youtube.com/watch?v=NaeqUp3jbls

btw... I'm going through the NeonHelium tutorial but is very old... and I don't find the glaux library (XCode4, gcc)... so pretty much all of the code wrote by NeHe is not useful to me...

I'm following the Addison, because although is older, it teachs in my opinion more profoundly what the heck all the things means.

I knew about the hex notation so I'm feeling embarassed up to 57005 for being misguided by a 0x in front of each hex representation...

Name: Anonymous 2011-12-05 19:47

>>2
>>3
>>5
>>7
>>8
>>9

but sincerly thank you for your help!!
have a nice evening!!

Name: Anonymous 2011-12-05 19:51

>>10
goto nehe they updated the textures to use SOIL
fucking finally, Addison is prolly also using glaux
mfw.jpg

Name: Anonymous 2011-12-05 20:00

DON'T FORGET ABOUT ENDIANNESS!

Name: Anonymous 2011-12-05 20:02

>>12
as far as I got no glaux spotted... it's using all OpenGL internal things...

and I can't find a PDF of the updated version, and all the sample code coming with the NeHe tutorial are still using glaux... so it's really a confusion of things...

so for exeample I get stuck even at the first include:

#include <window.h> //No such file or directory
HDC hDC =NULL; //doesn't work HDC does not name a type


the compiler says... file not found...
maybe is because I'm on a mac... or because I didn't linked the library or... or... well Addison works NeHe... nope...

Name: Anonymous 2011-12-05 20:05

>>14
http://nehe.gamedev.net/tutorial/texture_mapping/12038/
just sayin' download the MacOS version from the list at the bottom of the page, srsly wtf
while it is good for OpenGL many systems handle creating 'windows' diffrently

Name: Anonymous 2011-12-05 20:11

>>15
>download the MacOS version
scroll scroll:
The page you requested could not be found.

I'm not saying that NeHe did a bad job or anything. Is just that I tried, and it require too much work. I will still read that tutorial probably will teach me alot, but for now the only C/C++ oriented thing that I found in PDF format that works with my setup (shitty as hell) is the Addison....

Name: Anonymous 2011-12-05 23:25

>>2
http://en.wikipedia.org/wiki/Hexadecimal
Bruce A. Martin of Brookhaven National Laboratory considered the choice of A–F "ridiculous" and in a 1968 letter to the editor of the CACM proposed an entirely new set of symbols based on the bit locations, which did not gain much acceptance.[9]
http://en.wikipedia.org/wiki/File:Bruce_Martin_hexadecimal_notation_proposal.png
WWFVD?

Name: Anonymous 2011-12-05 23:29

>>17
[...] did not gain much acceptance.
Thank Christ.

Name: Anonymous 2011-12-05 23:34

>>17
http://en.wikipedia.org/wiki/File:Bruce_Martin_hexadecimal_notation_proposal.png
That's the dumbest shit I have ever seen. That dude is a fucking retard and a horrible programmer.

Name: Christ 2011-12-05 23:49

>>18
you're welcome

Name: Anonymous 2011-12-05 23:54

>>10
OR just use the built-in bin and hex functions retard

Name: Anonymous 2011-12-06 0:27

check out my floats

Name: Anonymous 2011-12-06 0:35

>>22
nice

Name: Anonymous 2011-12-06 2:13

>>21
my convertor looks nicer...

Name: Anonymous 2011-12-06 2:43

>>17
http://en.wikipedia.org/wiki/File:Bruce_Martin_hexadecimal_notation_proposal.png
That's awesome. Are these mapped to unicode? If not, I'm filing a proposal. I'm writing all my hexadecimal like this from now on.

Name: F r o z e n V o i d !!mJCwdV5J0Xy2A21 2011-12-06 6:09

Using a whole separate notation for hexadecimals is obviously retarded. Its waste of symbolsets.
There two representations which would fit better: purely alphabetic(A=0,B=1,C=2,D=3,E=4,F=5,G=6,H=7,I=8,J=9,K=10,L=11,M,=12,N=13,    O=14,P=15)  and numeric-alphabetic(used now 0-9/A-F).

Name: Anonymous 2011-12-06 12:15

>>26
You could even use Chinese symbols for representing numbers. There're about 5k of them (symbols), just imagine how much memory would this save!

Name: Anonymous 2011-12-06 13:49

INFINITE CHINESE MEMORY SAVINGS

Name: Anonymous 2011-12-06 13:55

˥
˦
˨
˩

Name: Anonymous 2011-12-06 13:56

>>28
fuck this is brilliant.
IT companies outsource shit from China aswell.
I always download moar RAM from China when I run my bloated VM programs

Don't change these.
Name: Email:
Entire Thread Thread List