examples/buffer/c.cc
raw| 1 | #include "c.h" |
| 2 | |
| 3 | static const int LEN = 1024*1024; |
| 4 | |
| 5 | static unsigned short int buffer[LEN] = {0,}; |
| 6 | |
| 7 | unsigned short int* GetBuffer() |
| 8 | { |
| 9 | return buffer; |
| 10 | } |
| 11 | |
| 12 | int GetBufferLen() |
| 13 | { |
| 14 | return LEN; |
| 15 | } |
| 16 | |
| 17 | unsigned short int GetBufferChecksum() |
| 18 | { |
| 19 | unsigned short int sum = 0; |
| 20 | for (int i = 0; i < LEN; sum += buffer[i++]); |
| 21 | return sum; |
| 22 | } |
| 23 | |
| 24 | |
| 25 |