ToDo:
¤Þ¤¡ rand ¤Ï̵¤¤¤Ã¤Æ¤Î¤Ï¤½¤¦¤À¤È»×¤¦¡£
http://blog.bugyo.tk/lyrical/2008/11/cdiv-1.html
#include <stdio.h> #include <stdlib.h> int main(int argc) { int i, j, sum = 0; int x = rand()%3+3; int y = argc + 10; for (i=0; i<10000000; i++) { for (j=0; j<10; j++) { #if 1 div_t d; d = div(x, y); sum += d.quot; sum += d.rem; #else sum += x / y; sum += x % y; #endif x++; y++; } } printf("%d\n", sum); return 0; }
¤È¤«¤Ç¤ä¤Ã¤Æ¤ß¤¿¡£
./a.out 0.83s user 0.00s system 97% cpu 0.845 total ./a.out 0.61s user 0.02s system 95% cpu 0.661 total
¤Ç div »È¤ï¤Ê¤¤Êý¤Î¾¡¤Á¤À¤Ã¤¿¡£ ¥¢¥»¥ó¥Ö¥ê¸«¤¿´¶¤¸ div ¤Ï´Ø¿ô¸Æ¤ó¤¸¤ã¤Ã¤Æ¤ë¤Ê¤¡ ½ü»»¤Ï¤¤Á¤ó¤È°ì²ó¤Ë¤Ê¤Ã¤Æ¤ë¤·¡£
¤Þ¤¡½ü»»¤¤Á¤ó¤ÈºÇŬ²½¤Ç¤¤ë¤Î¤Ë div ¤Ê¤ó¤Æ¥ì¥¢¤Ê¤â¤Î¤ò builtin ¤Ë¤¹¤ë°ÕÌ£¤Ê¤¤¤Ã¤Æ´¶¤¸¤«¤Ê¤¡¡£
°ì±þ gcc/builtins.c ¸«¤Æ¤â div ¤Ý¤¤¤Î¤Ï̵¤«¤Ã¤¿¡£
¤¢¤È¥Ù¥ó¥Á¥Þ¡¼¥¯¤Î¸å¤ÏÂÅÅö¤Ý¤¤¤«³Îǧ¤¹¤ë¼êÃʤȤ·¤Æ¡¢ ¥¯¥í¥Ã¥¯¿ô¤ò³µ»»¤·¤Æ¤ß¤ë¤È¤«¤¤¤¤¤È»×¤¦¡£ 1ÉÃÄøÅÙ¤«¤«¤Ã¤Æ¤ë¤ó¤Ê¤é¥ë¡¼¥×1²ó¤Ë¿ôÉ´¥¯¥í¥Ã¥¯¤¯¤é¤¤¤«¤«¤Ã¤Æ¤ë´¶¤¸¤Ç¡¢ ½ü»»¤À¤±¤Ç¤½¤ì¤Ï¤Á¤ç¤Ã¤È̵¤¤¤è¤Ê¤¡¤ß¤¿¤¤¤Ê¤½¤¦¤¤¤¦¡£
(00:43)
¤¯¤é¤¤¤Ê¤é¤¤¤¸¤Ã¤¿¤³¤È¤¢¤ë¤Ê¤¢¡£ ¤¢¤ì¤Ï¶ìÄˤËËþ¤ÁËþ¤Á¤Æ¤¤¤¿¡£
http://www.kt.rim.or.jp/%7ekbk/zakkicho/08/zakkicho0811c.html#D20081127-6
¤½¤ì¤Ï¤½¤¦¤È¤Þ¤µ¤Ë¹½Â¤ÂΤΥÀ¥ó¥×¤Î¤¿¤á¤Ë ¤³¤¤¤¦¤â¤Îºî¤Ã¤¿²áµî¤¬¤¢¤ë¤ï¤±¤Ç¤¹¤¬
http://d.hatena.ne.jp/shinichiro_h/20051230#1135939355
º£¤âÆ°¤¯¤«¤ÏÃΤé¤Ì¡¼
¤¦¤à 64bit linux ¤Ç¤ÏÆ°¤«¤ó¡£ º£Å٤ʤª¤¹¤«¤Ê¤¢¡£
(05:48)
Á° | 2008ǯ 11·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£