Do you discover any problem in the following code?
c->space_bits = fls(c->leb_size) - 3;
c->lpt_lnum_bits = fls(c->lpt_lebs);
c->lpt_offs_bits = fls(c->leb_size - 1);
c->lpt_spc_bits = fls(c->leb_size);
n = DIV_ROUND_UP(c->max_leb_cnt, UBIFS_LPT_FANOUT);
c->pcnt_bits = fls(n - 1)
This bug is inside the inline assmeble marco fls, you can not discover it in the C-level.
Let see the fls marco,
2.6.4 include/asm-arm/bitops.h
#define fls(x) \
( __builtin_constant_p(x) ? generic_fls(x) : \
({ int __r; asm("clz%?\t%0, %1" : "=r"(__r) : "r"(x)); 32-__r; }) )
clz, count the number of leading zero,
%0, result register
%1, operand register
"=r", output to C varaible
"r", input from C varaible
Since the clz instruction may alter the code register, so the following divion may be incorrect. There is a fix in 2.6.2x, which put "cc" in the Clobber List, it tell compiler there is a chance the cc will be changed by the inline asemble code.
2.6.2x arm/include/asm/bitops.h
static inline int fls(int x)
{
int ret;
if (__builtin_constant_p(x))
return constant_fls(x);
asm("clz\t%0, %1" : "=r" (ret) : "r" (x) : "cc");
ret = 32 - ret;
return ret;
}
2009年6月25日星期四
2009年6月18日星期四
不方便的pantry
2009年6月15日星期一
2009年4月21日星期二
大陸的侍應
因為工作的原因,今日去到廣洲,遇到個大陸的侍應好特別。
侍應對住一個同事講你飲d咩呀
同事a:可樂
侍應:支裝掟罐裝呀
同事a:支裝呀
咁我同另外個同事都要可樂,咁就話要3支可樂啦..
轉頭個侍應law左1.25升可樂3支俾我地 XD
今日既事令我想起另外兩件同大陸待應有關既..趣事
我個fd叫碟乾炒牛河..碟牛河入裡一塊牛肉都無。
同個侍應講..佢好吋咁話淨係得河粉嫁炸,唔會有牛肉。我個fd嬲到叫經理來,結果就成碟都係牛肉,少少可粉。
我又試過叫罐七汽,佢地俾個雪碧我,我話我要七汽喎,佢話未呢個就係七汽,
但明明有中文字寫住雪碧,><..講佢唔掂..得啖笑..我唯有照飲。
雖然我唔係一個開心既人,但係我好鐘意講笑話,我好想身邊既人會笑,會開心d,
以前有人一聽就聽我講左好多年無聊笑話,可能有成千上萬個,e家唔識講lu,
e家如果咩好笑會寫底同大家分享下,唔好怪我爛就好了。
侍應對住一個同事講你飲d咩呀
同事a:可樂
侍應:支裝掟罐裝呀
同事a:支裝呀
咁我同另外個同事都要可樂,咁就話要3支可樂啦..
轉頭個侍應law左1.25升可樂3支俾我地 XD
今日既事令我想起另外兩件同大陸待應有關既..趣事
我個fd叫碟乾炒牛河..碟牛河入裡一塊牛肉都無。
同個侍應講..佢好吋咁話淨係得河粉嫁炸,唔會有牛肉。我個fd嬲到叫經理來,結果就成碟都係牛肉,少少可粉。
我又試過叫罐七汽,佢地俾個雪碧我,我話我要七汽喎,佢話未呢個就係七汽,
但明明有中文字寫住雪碧,><..講佢唔掂..得啖笑..我唯有照飲。
雖然我唔係一個開心既人,但係我好鐘意講笑話,我好想身邊既人會笑,會開心d,
以前有人一聽就聽我講左好多年無聊笑話,可能有成千上萬個,e家唔識講lu,
e家如果咩好笑會寫底同大家分享下,唔好怪我爛就好了。
2009年4月18日星期六
2009年4月14日星期二
四叔減持中壽平保 袋160億
四叔減持中壽平保 袋160億
2009-04-14
去年沽貨 料較高峰期少賺逾120億
http://news.sina.com.hk/cgi-bin/nw/show.cgi/51/1/1/1100736/1.html
唔係想笑佢,就算佢好傻咁盡沽國壽同平保依然賺到160億,我一直hold貨到依家又如何呢?
叫做賺到少少錢可以睇醫生咁law.
不過升到咁,我打算放咁少少股票,調整完再買,今晚返去做下功課先@o@V!
2009年4月8日星期三
Vista auto shutdown
http://www.winhelponline.com/articles/186/1/Windows-Vista-Shutdownexe---Maximum-allowed-timeout-value-is-600-Seconds.html
訂閱:
文章 (Atom)