Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
Get HideMyAss! VPN, PC Mag's Top 10 VPNs of 2016 for 55% off for a Limited Time ×

Comment Re:As a C programmer (Score 1) 307

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;
}

Comment Re:As a C programmer (Score 1) 307

Dude. Here is a three-line solution. One statement per line. Passes all your tests.

void *my_memmove(void *d, void *s, size_t c) {
... for (size_t x=(uintptr_t)d<(uintptr_t)s||c<1?+1:-1,i=x==1?0:c-1;c;c--,i+=x)
....... ((uint8_t *)d)[i] = ((uint8_t *)s)[i];
... return d;
}

(Indentation using periods because Slashdot's formatting system is braindead.)

Comment Re:As a C programmer (Score 1) 307

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.

Comment Re:..doesnt factor in connection cost. (Score 1) 174

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.

Comment Re:Netflix has a unique and obvious strategy. (Score 1) 192

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.

Slashdot Top Deals

The ideal voice for radio may be defined as showing no substance, no sex, no owner, and a message of importance for every housewife. -- Harry V. Wade

Working...