48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include <stdlib.h>
|
|
#include <iostream>
|
|
|
|
void send(short *to, const short *from, size_t count)
|
|
{
|
|
size_t n=(count+7)/8;
|
|
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);
|
|
}
|
|
}
|
|
|
|
void send2(short *to, const short *from, size_t count)
|
|
{
|
|
int n=(count+7)/8;
|
|
switch(count%8){
|
|
case 0: while(--n>0){
|
|
*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++;
|
|
}
|
|
}
|
|
}
|
|
|
|
int main ( )
|
|
{
|
|
short a[256];
|
|
short sum = 0;
|
|
for ( int i = 0; i < sizeof(a)/sizeof(a[0]); ++i )
|
|
a[i] = 1;
|
|
|
|
send2( &sum, a, 0 );
|
|
std::cout << sum << std::endl;
|
|
return 0;
|
|
}
|