User:NUXI

From MTU LUG Wiki
Revision as of 22:16, 19 August 2015 by Jfledvin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
[19:50:08]  <NUXI>	jfledvin: my previous job way back when was embedded
[19:50:40]  <NUXI>	and we had rules about how the code should be endian independent (#ifdef BIG_ENDIAN if needed)
[19:50:56]  <NUXI>	well I needed 20 bytes of random data for cryptographic purposes
[19:51:05]  <NUXI>	and the random number function call gave me 4 bytes
[19:51:16]  <NUXI>	so I cast it onto an array
[19:51:26]  <mjgardes>	gotta get those in order
[19:51:28]  <NUXI>	i was told I had an endian issue in my code by a coworker
[19:51:41]  <NUXI>	on casting RANDOM data into another type
[19:52:20]  <NUXI>	it took entirely too long to convince this person that you cannot have an endian issue in that case
[19:52:33]  <NUXI>	checklist programming
[19:53:15]  <NUXI>	well halfway through that I changed my IRC nick to NUXI here and it kind of stuck
[19:56:20]  <Byan>	what would the solution even be >_>
[19:56:22]  <mjgardes>	in other words, you were too lazy to change it back
[19:57:02]  <NUXI>	Byan: i could actually have changed it so that the array always changed the integer the same way
[19:57:20]  <NUXI>	via #ifdef
[19:57:26]  <NUXI>	or ntohl()
[19:57:30]  <NUXI>	or a few other ways
[19:57:42]  <NUXI>	it was just stupid
[19:57:56]  <Byan>	but then you'd have to cast to something else and then do that?
[19:57:59]  <NUXI>	im not even sure if I argued my way out or if I just wrapper it in ntohl()
[19:58:05]  <Byan>	like that doesn't even make sense
[20:00:01]  <NUXI>	i think I put ntohl() on it, I often ended arguments there with mathematical proofs
[20:00:35]  <NUXI>	which they either got or gave up