¥È¥Ã¥× «Á°¤ÎÆüµ­(2008-11-29) ºÇ¿· ¼¡¤ÎÆüµ­(2008-12-01)» ÊÔ½¸

¤Ï¤¸¤á¤Æ¤Î¤Ë¤­

¤³¤³¤Î°ÌÃÖÉÕ¤±

2004|11|
2005|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|03|04|05|06|07|08|09|10|11|

ToDo:


2008-11-30

_ rand

¤Þ¤¡ 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)

_ ¥á¥ó¥Ð250

¤¯¤é¤¤¤Ê¤é¤¤¤¸¤Ã¤¿¤³¤È¤¢¤ë¤Ê¤¢¡£ ¤¢¤ì¤Ï¶ìÄˤËËþ¤ÁËþ¤Á¤Æ¤¤¤¿¡£

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)

¤ªÌ¾Á°:
E-mail:
¥³¥á¥ó¥È:
¿ÍÀ¸¡¢±§Ãè¡¢¤¹¤Ù¤Æ¤ÎÅú¤¨
ËÜÆü¤Î¥ê¥ó¥¯¸µ

Á° 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
1.shinh(2014-05-24 01:26) 2.kodera(2014-05-24 01:26) 3.kodera(2014-05-24 01:26)
search / home / index

Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ­¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£

shinichiro.hamaji _at_ gmail.com / shinichiro.h