[問題] uint16_t compare
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
NONE
問題(Question):
數值比較錯誤
餵入的資料(Input):
0x1000
預期的正確結果(Expected Output):
vlan_vid=present
錯誤結果(Wrong Output):
vlan_vid=0x1000 none=0x0 present=0x1000
程式碼(Code):(請善用置底文網頁, 記得排版)
if ((uint16_t) *f->value == OFPVID_NONE)
fprintf(stream, "vlan_vid= none vid=0x%x none=0x%x present=0x%x",
*((uint16_t*) f->value),OFPVID_NONE,OFPVID_PRESENT);
else if ((uint16_t) *f->value == OFPVID_PRESENT)
fprintf(stream, "vlan_vid= present");
補充說明(Supplement):
其他資料都正常 只有這筆資料有問題...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.248.245.178
→
02/08 10:17, , 1F
02/08 10:17, 1F
→
02/08 10:19, , 2F
02/08 10:19, 2F
→
02/08 10:23, , 3F
02/08 10:23, 3F
→
02/08 10:36, , 4F
02/08 10:36, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章