DocScrutinizer05 changed the topic of #qi-hardware to: Copyleft hardware - http://qi-hardware.com | hardware hackers join here to discuss Ben NanoNote, atben / atusb 802.15.4 wireless, and other community driven hw projects | public logging at http://en.qi-hardware.com/irclogs and http://irclog.whitequark.org/qi-hardware
jekhor_ has quit [Ping timeout: 276 seconds]
lekernel has quit [Quit: Leaving]
apelete has quit [Ping timeout: 264 seconds]
kristianpaul has joined #qi-hardware
kristianpaul has joined #qi-hardware
kristianpaul has quit [Changing host]
erikkugel has quit [Quit: Leaving.]
emeb has quit [Quit: Leaving.]
unclouded has joined #qi-hardware
Calyp has quit [Quit: gone working on freeconomy =o)]
KokAz has quit [Ping timeout: 260 seconds]
woakas has quit [Ping timeout: 260 seconds]
Freemor has joined #qi-hardware
Freemor has left #qi-hardware [#qi-hardware]
xiangfu has joined #qi-hardware
woakas has joined #qi-hardware
gbraad has joined #qi-hardware
gbraad has quit [Changing host]
gbraad has joined #qi-hardware
DocScrutinizer05 has quit [Read error: Operation timed out]
DocScrutinizer05 has joined #qi-hardware
qi-bot has quit [Ping timeout: 276 seconds]
gbraad has quit [Ping timeout: 240 seconds]
rz2k has quit []
fire has quit [Ping timeout: 264 seconds]
fire has joined #qi-hardware
guanucoluis has joined #qi-hardware
guanucoluis has quit [Read error: Connection reset by peer]
guanucoluis has joined #qi-hardware
wolfspraul has quit [Ping timeout: 255 seconds]
gbraad has joined #qi-hardware
gbraad has quit [Changing host]
gbraad has joined #qi-hardware
xiangfu has quit [Ping timeout: 256 seconds]
xiangfu has joined #qi-hardware
fire has quit [Quit: WeeChat 0.4.0]
<kyak> hm.. for example, i have "out = 25 >= input" in my code. Both out and input are unsigned char
<kyak> do i need to use the U suffix with 25?
<kyak> for what i understand, it makes a difference.. for (25 >= input) the comparison is carried out on type int, whereas for (25U >= input) the comparison is done on type unsigned int
gbraad has quit [Ping timeout: 264 seconds]
guanucoluis has quit [Ping timeout: 258 seconds]
fire has joined #qi-hardware
gbraad has joined #qi-hardware
gbraad has quit [Ping timeout: 264 seconds]
fire has quit [Quit: WeeChat 0.4.0]
kyak has quit []
kyak has joined #qi-hardware
jekhor_ has joined #qi-hardware
apelete has joined #qi-hardware
<larsc> shouldn't matter
roh has quit [Ping timeout: 260 seconds]
roh has joined #qi-hardware
<kyak> larsc: what if it's 32768, not 25? 32768 can be ambigous depending on platform
<kyak> well, 128 can be ambigous, too, since MSB is 1
<larsc> your unsigned char should get promoted to int
<larsc> since the whole range of unsigned char fits into a signed int
<larsc> things get messy if you compare a signed int with an unsigned int
<kyak> what happens in this case?
<larsc> good question, I'd need to look it up
<larsc> but I think you'd end up with both signed
<kyak> speaking about the promotion.. if i have (128 >= input), and compile it for 8-bit processor, i might not get the same results when i compile it for 16-bit.. Right?
<kyak> because for 8bit it essentially becomes (-1 >= input)..
<kyak> because of promotion.. So it is generally a godo practice to use U suffix, that would avoid this problem?
<larsc> It might depend on your platform, some 8bit archs still have 16bit integers
<larsc> but the extra U shouldn't hurt
<kyak> yeah, you are right
<kyak> i meant the integer size, not the architecture
xiangfu has quit [Ping timeout: 245 seconds]
jekhor_ has quit [Ping timeout: 264 seconds]
wolfspraul has joined #qi-hardware
qi-bot has joined #qi-hardware
unclouded has quit [Ping timeout: 245 seconds]
kilae has joined #qi-hardware
lekernel has joined #qi-hardware
mth has quit []
<wpwrak> if you have signed and unsigned, promotion is to unsigned
<wpwrak> that's why things like -1 > 1U yield "true"
Calyp has joined #qi-hardware
<kyak> why does -1+1U yield 0 then, not -2? :)
<kyak> i mean, maxint/2+2
<wpwrak> because 0xfff....+1 is 0+carry :)
<wpwrak> -1 is not maxuint/2 (or anything nearby) but maxuint-1
<wpwrak> err, just maxuint of courwe
<wpwrak> i.e., it's 0xff...ff
<kyak> not according to wikipedia :)
<wpwrak> huh ?
<kyak> 0xff is -0
<kyak> 0xff-1 is -1
<whitequark> wat?
<whitequark> -0?
<whitequark> 0xff is -1 in 2's complement machines
<wpwrak> well, i'm talking about two's complement
<kyak> oh, ok, i'm sorry
<wpwrak> which is what almost everything uses. if you can find a machine that used one's complement natively (good luck with that :), then you're right with -0
<kyak> so then -1+1U, promoted to unsigned int, is 0xff+0x01 - should be 0x01?
<whitequark> kyak: no. 0xff + 0x01 = 0x100, but it's then truncated to 8 bits
<whitequark> i.e. 0x00
<kyak> oh! i see!
<kyak> now i understand how it wraps aroudn zero..
<kyak> what is we have a machine where integer size is 8bit?
<kyak> how would it be able to hold 0x100?
<whitequark> kyak: it doesn't hold 0x100
<whitequark> you can emulate that by using two 8bit integers manually
<whitequark> or let your compiler do that
<whitequark> then each arithmetic operation will take more than one instruction. much more, usually
<kyak> how would it work without emulation?
<whitequark> kyak: it won't
<wpwrak> the one extra bit is usually represented by a "carry" flag. so in assembler, you'd just use that if you need to make larger operations. in C, the carry flag is not accessible.
<whitequark> 0x100 is not stored anywhere
<whitequark> ^ that
<kyak> wpwrak: does this carry flag essentially lets us use 9-bit integers or what?
<wpwrak> sort of, yes
<kyak> can we use two carry flags? :)
<wpwrak> e.g., you'd implement a 16 bit addition on an 8 bit cpu like this:
<wpwrak> mov r0, a_low; mov r1, a_high; mov r2, b_low; mov r3, b_high
<wpwrak> add r4, r0, r2; addc r5, r1, r3
<wpwrak> mov result_low, r4; mov result_high, r5
<wpwrak> "add" would be addition without carry while "addc" would be addition with carry. i.e., "add" does A+B while "addc" does A+B+C, where A and B are the summands and C is the carry bit.
<wpwrak> both add and addc would set the carry bit if the result wraps around 0xff
<wpwrak> the same concept applies to larger word sizes. i.e., if your cpu is 32 bits and you want to implement uint64_t addition, you'd use exactly the same algorithm
<kyak> yep, that's clear. .This is something you would do if you want to keep your result and not to overflow
<kyak> so if i do a -1+1U, and compile it for a machine with 8-bit integer size, i would suddenly get all of this extra code?
<kyak> what would happend if r0 holds 0xff, r1 holds 0x01, and i do add r3, r2, r1?
<kyak> hat's going to be in r3?
jekhor_ has joined #qi-hardware
pcercuei has joined #qi-hardware
xiangfu has joined #qi-hardware
xiangfu has quit [Ping timeout: 264 seconds]
xiangfu has joined #qi-hardware
xiangfu has quit [Read error: Connection reset by peer]
xiangfu has joined #qi-hardware
xiangfu has quit [Read error: Connection reset by peer]
xiangfu has joined #qi-hardware
xiangfu has quit [Read error: Connection reset by peer]
xiangfu has joined #qi-hardware
xiangfu has quit [Ping timeout: 245 seconds]
jekhor_ has quit [Ping timeout: 246 seconds]
pcercuei has quit [Ping timeout: 258 seconds]
pcercuei has joined #qi-hardware
LunaVorax has joined #qi-hardware
pcercuei has quit [Ping timeout: 260 seconds]
xiangfu has joined #qi-hardware
dlan^ has joined #qi-hardware
pcercuei has joined #qi-hardware
xiangfu has quit [Ping timeout: 260 seconds]
xiangfu has joined #qi-hardware
pcercuei has quit [Ping timeout: 258 seconds]
pcercuei has joined #qi-hardware
<wpwrak> kyak: r3 would be 0x00 (0xff+0x01 is 255 + 1 = 0 (mod 256))
<wpwrak> things would be a little different if you do this in C. e.g., int x = (unsigned char ) -1+1; would result in 256
xiangfu_ has joined #qi-hardware
dlan^ has quit [Remote host closed the connection]
pcercuei has quit [Read error: No route to host]
pcercuei has joined #qi-hardware
kristianpaul has quit [Quit: leaving]
<kyak> wpwrak: how is (mod 256) calculated if 256 (0x100) is not stored anywhere according to whitequark?
pcercuei has quit [Ping timeout: 252 seconds]
pcercuei has joined #qi-hardware
<wpwrak> in the assembler example ? well, it's implicit. (mod 256) means that you only have 8 bits
<wpwrak> maybe it becomes clearer if you picture it as an adder: each bit of the adder has three inputs and two outputs. the inputs are A and B, plus the Carry from the previous bit
<wpwrak> the outputs are the sum (just one bit) and the carry to the next bit
<wpwrak> the output is result = (A+B+Cin) & 1; carry_out = (A+B+Cin) >> 1;
<wpwrak> you have an adder for each bit, with the carry bits connected from LSB to MSB. Cin of LSB is either 0 or the carry flag, depending on whether you have an "add" or an "add-with-carry" operation
pcercuei has quit [Ping timeout: 258 seconds]
<wpwrak> this is what it looks like: http://en.wikipedia.org/wiki/Adder_(electronics)
guanucoluis has joined #qi-hardware
<larsc> if it helps think of it as AND 0xff rather than mod 256
<wpwrak> or just a bit falling off the edge of the world :)
<wpwrak> a sacrifice to entropy
<larsc> the lemming bit
<wpwrak> we should patent the carry as "lemming-bit catching aparatus". then sure intel, arm, etc. for a few cubic-gazillions
<wpwrak> s/sure/sue/
<qi-bot> wpwrak meant: "we should patent the carry as "lemming-bit catching aparatus". then sue intel, arm, etc. for a few cubic-gazillions"
<larsc> :)
<kyak> heh :)
<kyak> wpwrak: thanks for explanation
<wpwrak> i hope i made it clearer :)
<kyak> you did
<kyak> and and found some pictures of 8 bit adders
xiangfu_ has quit [Remote host closed the connection]
xiangfu has quit [Remote host closed the connection]
<DocScrutinizer05> ((<wpwrak> this is what it looks like: http://en.wikipedia.org/wiki/Adder_(electronics) )) which is what I built with Braun Lectron for our 150 year aniversary at my highshcool, been 13 y o iirc
<DocScrutinizer05> I built if from memory/designing it realtime in my mind
<DocScrutinizer05> and I actually used simple NAND /NOR gates only
<DocScrutinizer05> actually been a 4bit adder
<DocScrutinizer05> oops, I think I also had XOR
<DocScrutinizer05> and I must've been 15 already
<DocScrutinizer05> or 14
<kyak> did you mean you were 0xE? :)
<DocScrutinizer05> hehe
<DocScrutinizer05> :->
<larsc> 016
<DocScrutinizer05> there are only 10 kind of people
<DocScrutinizer05> those who know binary and those who don't
jekhor_ has joined #qi-hardware
<DocScrutinizer05> kyak: it should be mentioned maybe that you usually have only one ALU wide carry flag (and one sign flag), it gets used for all ADDC (and SUBC, and a few others) operations, no matter which registers are the operands and which the result
<wpwrak> at 13 you had your 150th anniversary ? are you a very small dog ? :)
<DocScrutinizer05> my highschool had 150
<DocScrutinizer05> ding says "secondary school"
<DocScrutinizer05> while "highschool" seems to be no english but a german word X-P
<DocScrutinizer05> and gymnasium is for sure a false friend :-P
<DocScrutinizer05> I prepared some show-off stuff for physics, in chemistry section a mad teacher made a ~10ml of trinitroglycerene
<DocScrutinizer05> my adder went mad each time the van-der-graaf nearby went "BANG" with a one meter spark. In chemistry all clothes trembled each time the teacher did a BANG with one drop of his stuff
<DocScrutinizer05> the highlight of the day been when I watched this teacher burning down the remaining 9.5ml of nitro
<DocScrutinizer05> at end of the day
<wpwrak> that was when they started building the new school ?
<DocScrutinizer05> I probably thought exactly same in that moment, but amazingly enough nothing specacular happened
<DocScrutinizer05> he poured the whole shit into a white ceramic bowl and burned it down with a bunsen
<DocScrutinizer05> about as spectacular as a candle with a slightly wet wick
<wpwrak> i'm sure the pouring needed a steady hand, though :)
<DocScrutinizer05> I think he didn't pour it from extreme height into that bowl, yeah
<DocScrutinizer05> but actually that stuff is quite inpredictable but usually less critical than urban legends suggest. In even younger years I tried to produce nitro maybe 50 times, and I was *sooo* sure this time it worked, everything exactly as it should, reaction observed, result like it should. Alas (or luckily) it _never_ exploded when I had a drop of it fall from 1st floor to stone pavement
<DocScrutinizer05> so every single time the content of the glaspipe ended in the bathroom sink and got flushed by plenty of tap water ;-)
<wpwrak> sometimes, failure can keep you out of juvenile jail :)
<DocScrutinizer05> yeah :-)
<larsc> or out of the hospital
<DocScrutinizer05> some austrian ashole here shipped letters with nitro and electric ignition some years ago
<DocScrutinizer05> none of them exploded prematurely
<DocScrutinizer05> some neonazi asshole
<DocScrutinizer05> several people lost fingers or a hand
<DocScrutinizer05> usually the secretary of those he meant to hurt
jekhor_ has quit [Ping timeout: 252 seconds]
jekhor_ has joined #qi-hardware
<DocScrutinizer05> >>However she did not open the letter; this being done by her assistant who was subsequently injured by the bomb<<
<DocScrutinizer05> those were nitro in a macdonalds straw
<DocScrutinizer05> CR2023 and some small electr(on)ics, and a spark device plugged into one end of straw
<DocScrutinizer05> 2032
<wpwrak> did they ever catch him ?
jekhor_ has quit [Ping timeout: 260 seconds]
<DocScrutinizer05> yep
<DocScrutinizer05> I seem to recall he even had an "accident" with one of his creations ;-P
<DocScrutinizer05> ooh, no. http://de.wikipedia.org/wiki/Franz_Fuchs_(Attentäter)
<DocScrutinizer05> suicide
Jurting_pc2 has joined #qi-hardware
<whitequark> argh
<whitequark> whoever wrote the http://de.wikipedia.org/wiki/Rohrbombe page is a terrible person
<whitequark> (NSFL.)
* whitequark just financed the extortioners in ISO: http://imgur.com/tATMmEs
Calyp has quit [Quit: gone working on freeconomy =o)]
<wpwrak> DocScrutinizer05: attempted suicide, followed a few years later by a successful one. not too bad in terms of poetic justice.
<DocScrutinizer05> :nod:
<wpwrak> nice ... xpdf is broken in ubuntu 12.10, too (was in 12.04 as well). i suppose the whole QA department of ubuntu was reassigned to work on their "value-added" gadgets ...
<DocScrutinizer05> who's using buntkuh? :-o
<wpwrak> (fortunately, building xpdf from source does solve the problem)
<wpwrak> well, it used to be quite good. but recently they seem to be confused.
<DocScrutinizer05> http://xkcd.com/424/
<DocScrutinizer05> I wholeheartedly agree with xkcd here, regarding buntkuh
pcercuei has joined #qi-hardware
<whitequark> worst of all... I don't even see how is that (proprietary services / stupid forking / mobile devices) going to help them
<wpwrak> ;-) naw, once you apt-get remove consolekit it's almost clean :)
<whitequark> huh? what's up with consolekit?
<wpwrak> removing it gets rid of a number of things i don't want :)
<whitequark> oh, the dependency hell
<whitequark> the person who wrote ruby's parse.y was on some serious drugs.
<wpwrak> my preferred session goes like this: boot, log in at the /bin/login prompt, startx, ... weeks pass
<whitequark> I think I've poured around 2 weeks into rewriting it in a sane way already
<whitequark> (why? need precise location reporter, otherwise type inferencer's error messages are unreadable)
<wpwrak> messy grammar ? or just poor implementation ?
<whitequark> these two, combined
<whitequark> the grammar is incredibly overloaded, { for example has four distinct context-specific meanings
<whitequark> plus the implementation is utterly insane
<wpwrak> sounds like fun :)
<whitequark> it depends on bison actions with side effects changing stacked state in the lexer in some way I *still* do not really understand
<whitequark> I even bought the ISO standard in a hope that it would clear some of this mess
<whitequark> well, it kinda helped, but not enough
<whitequark> worst of all
<whitequark> I think I began to understand this stuff ~today. and do you know why is it all needed?
LunaVorax has quit [Ping timeout: 260 seconds]
<whitequark> to handle two special cases of really, really screwed up syntactic combinations which are so utterly inconvenient, apart from being bad practice, that I think they weren't written by anyone ever once
<whitequark> and I mean things like a while..do (not just while) loop in the condition (not body!) clause of which there is another while..do loop
<whitequark> I mean I didn't even *know* ruby has while..do loops before I started hacking its parser.
<whitequark> neither did anyone I have asked since
<wpwrak> writing a parser, compiler, or similar often furthers your understanding of the language ;-)
<whitequark> ... reverse-engineering a parser.
<whitequark> reverse-engineering a frikkin open-source parser.
<whitequark> it is easier to just treat it as a black box...
<whitequark> the C lexer has three nested levels of switches with fallthoughs and breaks and continues *and* plenty of gotos
<whitequark> 11KLOC
<whitequark> this could serve as a poster example of why you should never, ever, use C to write complex software.
LunaVorax has joined #qi-hardware
pcercuei has quit [Ping timeout: 258 seconds]
pcercuei has joined #qi-hardware
unclouded has joined #qi-hardware
jekhor_ has joined #qi-hardware
KokAz has joined #qi-hardware
KokAz has quit [Remote host closed the connection]
KokAz has joined #qi-hardware
KokAz has quit [Remote host closed the connection]
<lekernel> whitequark, if you need standards, I€€€ publications etc. send me an email. I have access to many of those.
<whitequark> lekernel: too late in this case, but thanks for the offer!
<whitequark> I'll keep that in mind
<lekernel> they're also available for free at your local (physical) library, sometimes
<whitequark> doubt so
<whitequark> well, a ГОСТ will probably be available.
<lekernel> guest?
<whitequark> (a CIS international standard.)
<whitequark> aka GOST.
jekhor_ has quit [Ping timeout: 245 seconds]
pcercuei has quit [Ping timeout: 258 seconds]
Jurting_pc2 has quit [Read error: Connection reset by peer]
Jurting_pc2 has joined #qi-hardware
pcercuei has joined #qi-hardware
jekhor_ has joined #qi-hardware
guanucoluis has quit [Ping timeout: 258 seconds]
unclouded has quit [Ping timeout: 245 seconds]
unclouded has joined #qi-hardware
jekhor_ has quit [Ping timeout: 256 seconds]
kilae has quit [Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931]]
lekernel has quit [Ping timeout: 240 seconds]
pcercuei has quit [Quit: Bye]
lekernel has joined #qi-hardware
apelete has quit [Ping timeout: 264 seconds]