Yeah, but it is three lines of C (four if you count the function name/parameter line). So there. Bottom line counts. You asked for a 4-line solution and you got one.
Whoops. I forgot to remove ||c<1, which my original solution needed before it was golfed down to this. Code still runs correctly with it, though. Here is the simplified version:
If you copy 0-100 over to locations 50-150, then you have to copy backwards, copy the 100 over first, then 99, etc.
Wrong. You don't have to copy backwards at all in this case. You can copy 50–100 over to 100–150 using a forward copy operation, and then copy 0–49 to 50–99 also using a forward copy operation. No backward copy is needed.
Almost... but not quite. If dst == src, then return immediately without doing anything. If not, then compare to decide whether to do a forward or backward copy.
Yes, I understand all that. (And thanks for spelling it out for people who might not!)
However, I still think it sucks ass-barf that Netflix only has 26 of the top 250 movies on streaming. It's an unfortunate travesty. Not necessarily their fault, as you point out, but it still totally sucks and is incredibly lame.
Why would I want to do that? I can use the third mouse button to do that,
Mouse != Trackpoint
If you want to be ignorant of superior pointing devices, you can make that choice. Don't call other people dumb just because you prefer an inferior and less productive way to move your cursor.
Me on my trackpad can run circles around anyone on their trackpoint.
Yeah, but it is three lines of C (four if you count the function name/parameter line). So there. Bottom line counts. You asked for a 4-line solution and you got one.
Right. Just making a joke. Carry on. :)
p.s. You'll need to #include <stdint.h> to get uint8_t and uintptr_t, naturally.
Whoops. I forgot to remove ||c<1, which my original solution needed before it was golfed down to this. Code still runs correctly with it, though. Here is the simplified version:
void *my_memmove(void *d, void *s, size_t c) {
... for (size_t x=(uintptr_t)d<(uintptr_t)s?+1:-1,i=x==1?0:c-1;c;c--,i+=x)
....... ((uint8_t *)d)[i] = ((uint8_t *)s)[i];
... return d;
}
void *my_memmove(void *d, void *s, size_t c) {
}
(Indentation using periods because Slashdot's formatting system is braindead.)
The lineup of people waiting for their own toilet would stretch to the moon.
Average distance to the Moon is 238,900 miles. Divide this by 774 million and you get 1.63 feet or about 19.5 inches. Math checks out.
If you aren't worried about performance simply copy the block to a temporary spot before copying it to the destination.
Especially when moving several gigabytes up or down by 1 byte.
char isn't a byte type. Use uint8_t if you want bytes.
If you copy 0-100 over to locations 50-150, then you have to copy backwards, copy the 100 over first, then 99, etc.
Wrong. You don't have to copy backwards at all in this case. You can copy 50–100 over to 100–150 using a forward copy operation, and then copy 0–49 to 50–99 also using a forward copy operation. No backward copy is needed.
Almost... but not quite. If dst == src, then return immediately without doing anything. If not, then compare to decide whether to do a forward or backward copy.
It also doesn't account for the cost of a TV averaged out over the life of the TV. You need something to watch it on.
Of course it doesn't account for a teevee. You can watch Netflix on your phone, or your tablet, or your laptop computer, or your desktop computer.
Yes, I understand all that. (And thanks for spelling it out for people who might not!)
However, I still think it sucks ass-barf that Netflix only has 26 of the top 250 movies on streaming. It's an unfortunate travesty. Not necessarily their fault, as you point out, but it still totally sucks and is incredibly lame.
It has some. I wouldn't say it's full. Of the IMDB top 250 movies, at least as of March Netflix had 26 of them. Just over 10%.
That sucks ass barf. :(
Man, 10 years ago, Netflix used to actually be good.
But I know DVDs and mail are so "old school" these days. Perhaps hipsters will bring them back in a couple years.
I sincerely hope not. 480p content is shit.
No, the moral of the story is don't use your fingerprint as a password.
My voice is my password.
Three billion dollars can do a lot of useful things. It's not a blip even if your revenue is a trillion dollars.
$3B is a lot more than just a blip. $1M is just a blip. $3B is significant.
As you know, our blockade is perfectly legal.
https://www.youtube.com/watch?...
Once Ohio went to Obama, and Florida got called for Obama, the election was over Mitt Romney. History could repeat itself in 2016.
Not likely. Mitt Romney isn't even running in 2016.
s/PERL/Perl/g;
Perl is the name of the language. perl is the name of the binary. PERL isn't anything.
This doesn't seem possible to do accurately through a cellphone camera without some other lighting and/or color reference being present.
You mean, like, oh, maybe a built-in flash that exists on every smartphone camera?
Seriously? A dedicated device for this? In 2016? It should just be a smartphone app. No need for separate hardware.
Lame.
Why would I want to do that? I can use the third mouse button to do that,
Mouse != Trackpoint
If you want to be ignorant of superior pointing devices, you can make that choice. Don't call other people dumb just because you prefer an inferior and less productive way to move your cursor.
Me on my trackpad can run circles around anyone on their trackpoint.
Jebus. Wow. Thank you for elaborating on that. Wow. Pretty messed up.
My blood would burn through the raised floor tiles, so ... all right, I'll stay away.