Endian system tester |
|
dllee
站務副站長 發表:321 回覆:2519 積分:1711 註冊:2002-04-15 發送簡訊給我 |
靈感來自 lcsboy 的
□【分享】什麼是"Big Endian" & "Little Endian"
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=29224 因為自己也常接觸微處理器,如 8051,DSP,... 所以,寫這個程式來判斷該處理器是屬於何種系統。 程式碼很短,如下:
//--------------------------------------------------------------------------- #pragma hdrstop #pragma argsused #include我所用過的微處理器好像都是 'Little Endian',而我也一直認為這是「理所當然」的記憶體配置... 謝謝 lcsboy 的提醒。 註:以上的程式碼,是用一般 ANSI C 所寫,必需拿到您使用的系統(非 x86 的處理器) 重新組譯後,才能由執行的結果判斷該系統是 Big/Little/Unknown Endian System. 沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
附加檔案:29229_EndianTest.zip
|
dllee
站務副站長 發表:321 回覆:2519 積分:1711 註冊:2002-04-15 發送簡訊給我 |
執行結果:
This system is 'Little Endian'. for a long variable value is 0x12345678 and its storage order in memory : 0012FF88 : 0x78 0012FF89 : 0x56 0012FF8A : 0x34 0012FF8B : 0x12沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com |
dllee
站務副站長 發表:321 回覆:2519 積分:1711 註冊:2002-04-15 發送簡訊給我 |
程式碼重貼
<textarea cols="60" rows="10" class="cpp" name="code">
//--------------------------------------------------------------------------- #pragma hdrstop
#pragma argsused #include
------
http://www.ViewMove.com |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |