Heh. After I saw the picture and read the last paragraph ('Not of a word of that is true - but feel free to speculate anyway in 4,500 word blog post headlined "Google's Next Move"'), I had to go back to the top and check that it wasn't a joke/The Onion article.
That said, Slashdot conversation has always struck me to be a lot like bar talk: a lot of people shouting all at once, with some people shutting up once in a while to let some other (higher moderated) people have the floor, lotsa war stories, fistfights, and attempts at humour with various degrees of success. So linking to a website like that *from here* might not be such a bad idea after all;)
Okay, I'll try and see if I can figure this thing out (you have to admit, it screws with your mind just looking at it...):
You can implement a simple memcpy function like this:
void copy(char *from, char *to, int count) {
do {
*from++ = *to++;
count--;
} while(count > 0); }
So far, so good. Now Duff's problem was that this was too slow for his needs. He wanted to do loop unrolling, where each iteration in the loop does more operations, so that the entire loop has to iterate less. This means the 'is count > 0? if so, go back, otherwise go on' part of the loop has to execute fewer times.
Now, the obvious problem with this is that you don't know how much you can unwind this particular loop. If it has 2 elements, you can't unwind it to three elements, for instance.
This is where Duff's Device turns up:
int n = (count + 7) / 8;/* count > 0 assumed */
switch (count % 8)
{
case 0: do { *to = *from++;
case 7: *to++ = *from++;
case 6: *to++ = *from++;
case 5: *to++ = *from++;
case 4: *to++ = *from++;
case 3: *to++ = *from++;
case 2: *to++ = *from++;
case 1: *to++ = *from++;
} while (--n > 0);
}
First, we check to see how much we can unroll the loop - for instance, if count is perfectly divisible by 5, but not 6, 7, or 8, in which case we can safely have 5 copies inside our loop without worry that the copy is going to move past the end of the array. Then - and here's the magic trick - we use switch to jump into a do loop. It's a perfectly ordinary do loop; the trick is entirely in the fact that if count==6, for instance, then C considers the do-loop to begin at 'case 6:', causing 6 copies of '*to++ = *from++' to be executed before the 'while' returns the loop position to the 'case 6:' point which is where, as far as C is concerned, the do-loop began.
Thus, the loop is unwound to a level that it can handle.
Yeah, that's what I thought too, but you've just gotta read between the lines! From the first link:
GOOGLE HAS confirmed that it will... take on Microsoft....
The other day, when Sun's Scott McNealy and... Google... met up,... wary... point blank, McNealy said... was something to be investigated. However Sun's Australian spokesman Paul O'Connor was a little more forthright... he... bubbled... wa[r]s... for Microsoft.
So: FreeBSD is going to kill Linux, Linux is going to kill Sun, Sun is going to kill Microsoft, Microsoft is going to f-ing kill Google, and Google is going to... kill evil?
My, America *is* a violent place these days, isn't it?:P
Our apologies; the people responsible for the last post have been fired. Entirely new posts discussing the future ramifications of space elevators will replace them shortly. Meanwhile, here are some delicious pictures of a traditiønal møøse picnic from the wild snøw covered peaks of Nørway.
"the user interface markup language for Windows Vista, the next version of Microsoft Windows."... "XAML is a declarative XML-based language optimized for describing graphically rich visual user interfaces, such as those created by Macromedia Flash"... "This Microsoft Windows article is a stub. You can help Wikipedia by expanding it."
I thought you were supposed to do that, if you couldn't afford to get a SSL key/for small websites where the money could be better spent? I been doing it wrong all along?
you are by default (as written in the Koran) an enemy Allah and must be killed
wtf is an enemy Allah? Allah == God, yeah?
And FYI. Islam comes from the root word of Aslama which translate to "to surrender, resign oneself" in arabic. In other words, you don't live your life for yourself. You live your live for the sole purpose to be directed and guided by Allah. In return for your unbridled loyalty, you are promised salvation.
From Luke 22:42: "Father, if you are willing, take this cup from me; yet not my will, but yours be done."
Surrendering is imho a fairly common concept in most religions.
Re:Wanted: a few billion algae to help me move
on
Algae Can Carry Cargo
·
· Score: 1
Well, pigeons is an improvement over snakes. On the other hand, as a camel devotee, I think your parrot idea has much to commend it ...
Heh. After I saw the picture and read the last paragraph ('Not of a word of that is true - but feel free to speculate anyway in 4,500 word blog post headlined "Google's Next Move"'), I had to go back to the top and check that it wasn't a joke/The Onion article.
;)
That said, Slashdot conversation has always struck me to be a lot like bar talk: a lot of people shouting all at once, with some people shutting up once in a while to let some other (higher moderated) people have the floor, lotsa war stories, fistfights, and attempts at humour with various degrees of success. So linking to a website like that *from here* might not be such a bad idea after all
You can implement a simple memcpy function like this:So far, so good. Now Duff's problem was that this was too slow for his needs. He wanted to do loop unrolling, where each iteration in the loop does more operations, so that the entire loop has to iterate less. This means the 'is count > 0? if so, go back, otherwise go on' part of the loop has to execute fewer times.
Now, the obvious problem with this is that you don't know how much you can unwind this particular loop. If it has 2 elements, you can't unwind it to three elements, for instance.
This is where Duff's Device turns up:First, we check to see how much we can unroll the loop - for instance, if count is perfectly divisible by 5, but not 6, 7, or 8, in which case we can safely have 5 copies inside our loop without worry that the copy is going to move past the end of the array. Then - and here's the magic trick - we use switch to jump into a do loop. It's a perfectly ordinary do loop; the trick is entirely in the fact that if count==6, for instance, then C considers the do-loop to begin at 'case 6:', causing 6 copies of '*to++ = *from++' to be executed before the 'while' returns the loop position to the 'case 6:' point which is where, as far as C is concerned, the do-loop began.
Thus, the loop is unwound to a level that it can handle.
I think.
Feel free to correct/amplify/mock.
cheers,
Gaurav
Yeah, that's what I thought too, but you've just gotta read between the lines! From the first link:
... take on Microsoft. ...
... Google ... met up, ... wary ... point blank, McNealy said ... was something to be investigated. However Sun's Australian spokesman Paul O'Connor was a little more forthright ... he ... bubbled ... wa[r]s ... for Microsoft.
GOOGLE HAS confirmed that it will
The other day, when Sun's Scott McNealy and
See, there ya go!
Thanks, tktk! :)
...)
/quits ggvaidya
(p.s. mods - parent is FUNNY, not offtopic
Your wish is my command.
Anything else I can do you for?
Oooh .. Ahhh .. That's how it always starts. Then later there's running ... and screaming ... and bug spray ...
So: FreeBSD is going to kill Linux, Linux is going to kill Sun, Sun is going to kill Microsoft, Microsoft is going to f-ing kill Google, and Google is going to ... kill evil?
:P
My, America *is* a violent place these days, isn't it?
Totally agree. And nicely said.
FBI agents always signs on as 'FBI'. :)
Our apologies; the people responsible for the last post have been fired. Entirely new posts discussing the future ramifications of space elevators will replace them shortly. Meanwhile, here are some delicious pictures of a traditiønal møøse picnic from the wild snøw covered peaks of Nørway.
You mean Arthur C. Clarke? :)
</fanboi>
Was hoping those in the know would be tempted to click in and improve it, obviously :). Was kind of disappointed at how short the article was.
cheers.
XAML.
... "XAML is a declarative XML-based language optimized for describing graphically rich visual user interfaces, such as those created by Macromedia Flash" ... "This Microsoft Windows article is a stub. You can help Wikipedia by expanding it."
"the user interface markup language for Windows Vista, the next version of Microsoft Windows."
*blinks
I thought you were supposed to do that, if you couldn't afford to get a SSL key/for small websites where the money could be better spent? I been doing it wrong all along?
FUCKING. BRILLIANT.
:D
You just made my day
Hey, just cos you haven't paid up your 699$ for Linux(TM) ...
4. ???
5. Profit
Oh, no, it's not!
-- The NYT
3010: 10 year anniversary of Windows Vista.
you are by default (as written in the Koran) an enemy Allah and must be killed
wtf is an enemy Allah? Allah == God, yeah?
And FYI. Islam comes from the root word of Aslama which translate to "to surrender, resign oneself" in arabic. In other words, you don't live your life for yourself. You live your live for the sole purpose to be directed and guided by Allah. In return for your unbridled loyalty, you are promised salvation.
From Luke 22:42: "Father, if you are willing, take this cup from me; yet not my will, but yours be done."
Surrendering is imho a fairly common concept in most religions.
Congratulations to parent and GP! :)
Surely you mean: can they carry Linus?
by ianturton (655126) on Monday August 22, @10:15AM (#13371337)
:D
Man, that's LEET!
"Where is the megafauna? Behind the rabbit?"
"It *IS* the rabbit, my lord!"