-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

  >>> On Saturday 27 Dec 2003 12:27 pm, KS <Kapil Sethi> said:
    KS> Hi,
    KS>
    KS> No it is not intended as a test.
    KS>
    KS> Actually, I have case before me where a 32 bit register is used to
 store KS> varying number of fields depending on the situation (network
 packet in my KS> case). so sometimes a field is 7 bits in other cases it is
 13 bits and so KS> on. So I wanted to avoid doing binary to hexa in my mind
 every time i need KS> to put binary value into the field.
    KS>
    KS> So i would be happy to be able to put value as full 32bit in one go
 in KS> binary representation to the register. The binary representation will
 enable KS> me to see where i wanted to put 1 and where 0 instead of
 converting hexa to KS> binary and binary to hexa in my brain. ( Puts a lot
 of stress considering I KS> am not a full time programmer.)
    KS>

Hi,
 No offence but I think your query should be posted to some programmers list. 
I don't see any reason why it should be posted to a Linux user group, unless 
you think that some very smart programmers frequent this list (btw I am sure 
there are lots!). 

 I suggest you create a bit mask macro in C to ease your troubles. Write a 
small macro to input in binary format and return in hex format. There is no 
way to directly assign binary numbers like hex or octal numbers, considering 
the fact that that *everything* is stored in binary. I don't understand why 
you are saying that it is more difficult using hex than binary. I think it is 
far easier to talk in hex than in binary! In fact that's why those geeks the 
started using hexadecimal system in the first place, ie primarily to 
represent binary numbers in shorthand notation for ease.

 You can also consider using a binary to hex calculator (search in google. One 
can be found at http://math.hws.edu/TMCM/java/DataReps/ ). Then enter the 
binary digits, get the hex output, and input the hex result using 0x prefix.   

 I would still suggest to use the hex system. In fact, working with network 
packets, you should definitely use hex. Get used to it. Its far more 
convenient. Look, even my GPG key is shown in HEX!


Regards,
Bhaskar.


- -- 

_______________________________

 Bhaskar Dutta <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
     GPG .eq. AA56 1EB5 D7E8 DD9C 298E  8F4D 375F D416 01D5 671C
- -------------------------------
 http://qhotwire.sourceforge.net/bhaskar-gpg-public.key
_______________________________


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/7UJqN1/UFgHVZxwRAoY6AJ45HWwPxR197yo+qFopKUbWCKJE5ACfbfkH
Ous4eEXXGQqxQxTj6W27xU0=
=k4Fn
-----END PGP SIGNATURE-----


_______________________________________________
ilugd mailing list
[EMAIL PROTECTED]
http://frodo.hserus.net/mailman/listinfo/ilugd

Reply via email to