![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/emscripten/tests/core/ |
Upload File : |
#include <stdio.h> #include <string.h> #include <assert.h> #define TOTAL 10240 #define TEST(size, type) { \ for (int i = 0; i < TOTAL; i++) { \ buffer[i] = i*seed; \ } \ memcpy(buffer, buffer+size+1, size*sizeof(type)); \ int v = 0; \ for (int i = 0; i < TOTAL; i++) { \ v += buffer[i]; \ } \ printf("final %d:%d\n", size, v); \ } int main() { #define RUN(type) \ { \ type buffer[TOTAL]; \ volatile int seed = 123; \ TEST(1, type); \ TEST(2, type); \ TEST(3, type); \ TEST(4, type); \ TEST(5, type); \ TEST(6, type); \ TEST(7, type); \ TEST(8, type); \ TEST(9, type); \ TEST(10, type); \ TEST(16, type); \ TEST(32, type); \ TEST(64, type); \ TEST(128, type); \ TEST(256, type); \ TEST(512, type); \ TEST(1024, type); \ for (int x = 10; x < 100; x += 10) { TEST(x, type) }; \ } printf("8\n"); RUN(unsigned char); printf("16\n"); RUN(unsigned short); printf("32\n"); RUN(unsigned); return 1; }