a25_kharcs8
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
* バイナリサイズ比較
-(by [[K]], 2025.07.26)
** (1) これをコンパイルして(リンクはしないで).textのサ...
//#include "kharc.h"
int openWin(int xsiz, int ysiz);
int isClose(int win);
void wait(int msec);
void fillRect(int w, int xsiz, int ysiz, int x, int y, i...
void drawLine(int w, int x0, int y0, int x1, int y1, int...
int ff16Sqrt(int x);
int ff16Sin(int x);
void wave()
{
int w, t, x, y, d, z, x0, y0, x1, y1, y0x0, y0x1, y1...
w = openWin(640, 480);
for (t = 0; isClose(w) == 0; t++) {
wait(8); fillRect(w, 640, 480, 0, 0, 0x000000);
for (y1 = 0; y1 < 42; y1++) { y0 = y1 - 1; y = y...
for (x1 = 0; x1 < 42; x1++) { x0 = x1 - 1; x...
d = ff16Sqrt((x * x + y * y) * 65536);
z = ff16Sin(((d * 652) >> 12) - 1043 * t...
y0x0 = y0 * 42 + x0; y0x1 = y0 * 42 + x1...
gx[y1x1] = (x * 2 - y * 2 + z * 0) * 4 +...
gy[y1x1] = (x * 2 + y * 2 + z * 1) * 2 +...
if (x0 >= 0 && y0 >= 0) {
drawLine(w, gx[y0x0], gy[y0x0], gx[y...
drawLine(w, gx[y0x0], gy[y0x0], gx[y...
}
}
}
}
}
-このプログラムではintは32bit以上のビット幅を想定していま...
-wait()関数はミリ秒単位でsleepする関数ですが、sleepに入る...
-ff16Sqrt()やff16Sin()は下記のような動作をする関数です。
int ff16Sqrt(int x) { return (int) (sqrt(x * (1.0 / 6553...
int ff16Sin(int x) { return (int) (sin(x * (2 * 3.141592...
** (2) 実験手順
>gcc --version
gcc (GCC) 3.4.5 (mingw-vista special r3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying condit...
warranty; not even for MERCHANTABILITY or FITNESS FOR A ...
>gcc -c -Os 3dwave-bench.c
>objdump -h 3dwave-bench.o
3dwave-bench.o: file format pe-i386
Sections:
Idx Name Size VMA LMA File off...
0 .text 00000218 00000000 00000000 0000008c...
CONTENTS, ALLOC, LOAD, RELOC, READONLY...
1 .data 00000000 00000000 00000000 00000000...
ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000000...
ALLOC
-この場合、.textのサイズは0x218バイト。つまり536バイト。
-実行ファイルは.textの情報だけからでは構築できないけれど...
** (3) 結果のまとめ
|RIGHT:124バイト|uck||2025.07.27版|
|||||
|RIGHT:356バイト|ELF 32-bit LSB relocatable, ARM, EABI5 v...
|RIGHT:425バイト|COFF OBJECT(14c:x86)|cl /O1 /Fobench.obj...
|RIGHT:504バイト|COFF OBJECT(8664:x64)|cl /O1 /Fobench.ob...
|RIGHT:521バイト|elf64-x86-64|gcc -m64 -c -Os bench.c|gcc...
|RIGHT:536バイト|pe-i386|gcc -c -Os 3dwave-bench.c|gcc (G...
|RIGHT:544バイト|ELF 64-bit LSB relocatable, ARM aarch64,...
|RIGHT:610バイト|elf32-i386|gcc -m32 -c -Os bench.c|gcc (...
終了行:
* バイナリサイズ比較
-(by [[K]], 2025.07.26)
** (1) これをコンパイルして(リンクはしないで).textのサ...
//#include "kharc.h"
int openWin(int xsiz, int ysiz);
int isClose(int win);
void wait(int msec);
void fillRect(int w, int xsiz, int ysiz, int x, int y, i...
void drawLine(int w, int x0, int y0, int x1, int y1, int...
int ff16Sqrt(int x);
int ff16Sin(int x);
void wave()
{
int w, t, x, y, d, z, x0, y0, x1, y1, y0x0, y0x1, y1...
w = openWin(640, 480);
for (t = 0; isClose(w) == 0; t++) {
wait(8); fillRect(w, 640, 480, 0, 0, 0x000000);
for (y1 = 0; y1 < 42; y1++) { y0 = y1 - 1; y = y...
for (x1 = 0; x1 < 42; x1++) { x0 = x1 - 1; x...
d = ff16Sqrt((x * x + y * y) * 65536);
z = ff16Sin(((d * 652) >> 12) - 1043 * t...
y0x0 = y0 * 42 + x0; y0x1 = y0 * 42 + x1...
gx[y1x1] = (x * 2 - y * 2 + z * 0) * 4 +...
gy[y1x1] = (x * 2 + y * 2 + z * 1) * 2 +...
if (x0 >= 0 && y0 >= 0) {
drawLine(w, gx[y0x0], gy[y0x0], gx[y...
drawLine(w, gx[y0x0], gy[y0x0], gx[y...
}
}
}
}
}
-このプログラムではintは32bit以上のビット幅を想定していま...
-wait()関数はミリ秒単位でsleepする関数ですが、sleepに入る...
-ff16Sqrt()やff16Sin()は下記のような動作をする関数です。
int ff16Sqrt(int x) { return (int) (sqrt(x * (1.0 / 6553...
int ff16Sin(int x) { return (int) (sin(x * (2 * 3.141592...
** (2) 実験手順
>gcc --version
gcc (GCC) 3.4.5 (mingw-vista special r3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying condit...
warranty; not even for MERCHANTABILITY or FITNESS FOR A ...
>gcc -c -Os 3dwave-bench.c
>objdump -h 3dwave-bench.o
3dwave-bench.o: file format pe-i386
Sections:
Idx Name Size VMA LMA File off...
0 .text 00000218 00000000 00000000 0000008c...
CONTENTS, ALLOC, LOAD, RELOC, READONLY...
1 .data 00000000 00000000 00000000 00000000...
ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000000...
ALLOC
-この場合、.textのサイズは0x218バイト。つまり536バイト。
-実行ファイルは.textの情報だけからでは構築できないけれど...
** (3) 結果のまとめ
|RIGHT:124バイト|uck||2025.07.27版|
|||||
|RIGHT:356バイト|ELF 32-bit LSB relocatable, ARM, EABI5 v...
|RIGHT:425バイト|COFF OBJECT(14c:x86)|cl /O1 /Fobench.obj...
|RIGHT:504バイト|COFF OBJECT(8664:x64)|cl /O1 /Fobench.ob...
|RIGHT:521バイト|elf64-x86-64|gcc -m64 -c -Os bench.c|gcc...
|RIGHT:536バイト|pe-i386|gcc -c -Os 3dwave-bench.c|gcc (G...
|RIGHT:544バイト|ELF 64-bit LSB relocatable, ARM aarch64,...
|RIGHT:610バイト|elf32-i386|gcc -m32 -c -Os bench.c|gcc (...
ページ名: