https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&feed=atom&action=history
Writing portable code regarding the processor architecture/id - Revision history
2024-03-29T12:44:38Z
Revision history for this page on the wiki
MediaWiki 1.35.6
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=97182&oldid=prev
FTurtle at 22:39, 25 October 2015
2015-10-25T22:39:30Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 22:39, 25 October 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l78" >Line 78:</td>
<td colspan="2" class="diff-lineno">Line 78:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 32 Bit vs. 64 Bit ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 32 Bit vs. 64 Bit ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Untuk mencapai kompatibilitas maksimum dengan kode lebih lama, FPC tidak mengubah ukuran tipe data yang sudah didefinisikan seperti <tt>[[Integer|integer]]</tt>, <tt>[[longint]]</tt> atau <tt>[[word]]</tt> ketika mengubah dari 32 ke 64 Bit. Akan tetapi, ukuran pointer adalah 8 byte pada arsitektur 64 bit maka membentuk seperti <tt>longint([[pointer]](p))</tt> pasti rusak pada arsitektur 64 bit. Untuk membolehkan anda menulis kode portabel, unit system FPC memperkenalkan tipe <tt>[[Ptrint|PtrInt]]</tt> dan <tt>[[Ptruint|PtrUInt]]</tt> yang adalah tipe data integer signed dan unsigned dengan ukuran yang sama sebagai sebuah pointer.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Untuk mencapai kompatibilitas maksimum dengan kode lebih lama, FPC tidak mengubah ukuran tipe data yang sudah didefinisikan seperti <tt>[[Integer|integer]]</tt>, <tt>[[longint]]</tt> atau <tt>[[<ins class="diffchange diffchange-inline">Word|</ins>word]]</tt> ketika mengubah dari 32 ke 64 Bit. Akan tetapi, ukuran pointer adalah 8 byte pada arsitektur 64 bit maka membentuk seperti <tt>longint([[pointer]](p))</tt> pasti rusak pada arsitektur 64 bit. Untuk membolehkan anda menulis kode portabel, unit system FPC memperkenalkan tipe <tt>[[Ptrint|PtrInt]]</tt> dan <tt>[[Ptruint|PtrUInt]]</tt> yang adalah tipe data integer signed dan unsigned dengan ukuran yang sama sebagai sebuah pointer.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Harap diingat bahwa perubahan ukuran dari tipe "pointer" juga mempengaruhi ukuran record. Jika anda mengalokasikan records dengan ukuran tetap, dan tidak dengan [[new]] atau dengan [[getmem]] (<x>,[[sizeof]](<x>)), ini harus dibetulkan.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Harap diingat bahwa perubahan ukuran dari tipe "pointer" juga mempengaruhi ukuran record. Jika anda mengalokasikan records dengan ukuran tetap, dan tidak dengan [[new]] atau dengan [[getmem]] (<x>,[[sizeof]](<x>)), ini harus dibetulkan.</div></td></tr>
</table>
FTurtle
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=93124&oldid=prev
FTurtle at 18:24, 16 July 2015
2015-07-16T18:24:54Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 18:24, 16 July 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{Editing Writing portable code regarding the processor architecture}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Ada beberapa isu utama saat menulis kode yang portabel sehubungan dengan arsitektur prosesor: endianness dan prosesor [[32 bit|32]] vs. [[64 bit]].</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Ada beberapa isu utama saat menulis kode yang portabel sehubungan dengan arsitektur prosesor: endianness dan prosesor [[32 bit|32]] vs. [[64 bit]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>
FTurtle
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=86011&oldid=prev
Swen at 17:15, 26 January 2015
2015-01-26T17:15:01Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 17:15, 26 January 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l70" >Line 70:</td>
<td colspan="2" class="diff-lineno">Line 70:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* padatkan sebelum setiap field yang dijajarkan pada multipel ukurannya (maka longint pada 4, int64 pada 8 bytes dll). Ini biasanya dikerjakan oleh kompilator C, yang mengapa FPC memanggilnya {$packrecords C}. </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* padatkan sebelum setiap field yang dijajarkan pada multipel ukurannya (maka longint pada 4, int64 pada 8 bytes dll). Ini biasanya dikerjakan oleh kompilator C, yang mengapa FPC memanggilnya {$packrecords C}. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>(Untuk [[<del class="diffchange diffchange-inline">array</del>/id|array]] atau [[nested record/id|nested record]], ukuran sub unit terbesarnya yang digunakan)</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>(Untuk [[<ins class="diffchange diffchange-inline">Array</ins>/id|array]] atau [[nested record/id|nested record]], ukuran sub unit terbesarnya yang digunakan)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Mac OS X {$packrecords C} nampaknya memadatkan seluruh record di akhir guna memastikan ukuran tertentu. Ini masih diinvestigasi, dan mungkin akan dibetulkan dalam kompilator.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Mac OS X {$packrecords C} nampaknya memadatkan seluruh record di akhir guna memastikan ukuran tertentu. Ini masih diinvestigasi, dan mungkin akan dibetulkan dalam kompilator.</div></td></tr>
</table>
Swen
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=26249&oldid=prev
Adezm: /* Penjajaran */
2008-01-11T13:15:58Z
<p><span dir="auto"><span class="autocomment">Penjajaran</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 13:15, 11 January 2008</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l70" >Line 70:</td>
<td colspan="2" class="diff-lineno">Line 70:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* padatkan sebelum setiap field yang dijajarkan pada multipel ukurannya (maka longint pada 4, int64 pada 8 bytes dll). Ini biasanya dikerjakan oleh kompilator C, yang mengapa FPC memanggilnya {$packrecords C}. </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* padatkan sebelum setiap field yang dijajarkan pada multipel ukurannya (maka longint pada 4, int64 pada 8 bytes dll). Ini biasanya dikerjakan oleh kompilator C, yang mengapa FPC memanggilnya {$packrecords C}. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>(Untuk [[array]] atau [[nested record]], ukuran sub unit terbesarnya yang digunakan)</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>(Untuk [[<ins class="diffchange diffchange-inline">array/id|</ins>array]] atau [[<ins class="diffchange diffchange-inline">nested record/id|</ins>nested record]], ukuran sub unit terbesarnya yang digunakan)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Mac OS X {$packrecords C} nampaknya memadatkan seluruh record di akhir guna memastikan ukuran tertentu. Ini masih diinvestigasi, dan mungkin akan dibetulkan dalam kompilator.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Mac OS X {$packrecords C} nampaknya memadatkan seluruh record di akhir guna memastikan ukuran tertentu. Ini masih diinvestigasi, dan mungkin akan dibetulkan dalam kompilator.</div></td></tr>
</table>
Adezm
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=24331&oldid=prev
Adezm: /* Penjajaran */
2007-09-29T19:43:10Z
<p><span dir="auto"><span class="autocomment">Penjajaran</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:43, 29 September 2007</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l62" >Line 62:</td>
<td colspan="2" class="diff-lineno">Line 62:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Penjajaran ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Penjajaran ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Some processors will allow improperly aligned </del>data <del class="diffchange diffchange-inline">but with reduced efficiency </del>(IBM 370/zSeries). <del class="diffchange diffchange-inline">Some processors generate </del>hardware <del class="diffchange diffchange-inline">processor exceptions when </del>data <del class="diffchange diffchange-inline">is badly aligned </del>(<del class="diffchange diffchange-inline">e.g. </del>Alpha <del class="diffchange diffchange-inline">or </del>ARM). <del class="diffchange diffchange-inline">Sometimes the </del>hardware <del class="diffchange diffchange-inline">exceptions are caught and fixed using emulation by the </del>OS, <del class="diffchange diffchange-inline">but this is very slow</del>, <del class="diffchange diffchange-inline">and should be avoided</del>. <del class="diffchange diffchange-inline">This can also cause </del>records <del class="diffchange diffchange-inline">to have different sizes</del>, <del class="diffchange diffchange-inline">so always use </del>sizeof(recordtype); <del class="diffchange diffchange-inline">as size of a </del>record. <del class="diffchange diffchange-inline">If you define a </del>packed record, <del class="diffchange diffchange-inline">try to ensure that </del>data <del class="diffchange diffchange-inline">is naturally aligned</del>, <del class="diffchange diffchange-inline">if possible</del>. <del class="diffchange diffchange-inline">Some processors only have alignment requirements for certain types of </del>data, <del class="diffchange diffchange-inline">like </del>floating point (<del class="diffchange diffchange-inline">e.g. older PowerPCs</del>). </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Beberapa prosesor akan membolehkan penjajaran </ins>data <ins class="diffchange diffchange-inline">yang tidak benar dengan mengurangi efisiensi </ins>(IBM 370/zSeries). <ins class="diffchange diffchange-inline">Beberapa prosesor membuat eksepsi prosesor </ins>hardware <ins class="diffchange diffchange-inline">saat </ins>data <ins class="diffchange diffchange-inline">dijajarkan dengan buruk </ins>(<ins class="diffchange diffchange-inline">misalnya </ins>Alpha <ins class="diffchange diffchange-inline">atau </ins>ARM). <ins class="diffchange diffchange-inline">Adakalanya eksepsi </ins>hardware <ins class="diffchange diffchange-inline">ditangkap dan dibetulkan menggunakan emulasi oleh </ins>OS, <ins class="diffchange diffchange-inline">tapi ini sangat lambat</ins>, <ins class="diffchange diffchange-inline">dan harus dihindari</ins>. <ins class="diffchange diffchange-inline">Ini juga bisa menyebabkan </ins>records <ins class="diffchange diffchange-inline">harus mempunyai ukuran berbeda</ins>, <ins class="diffchange diffchange-inline">maka selalu gunakan </ins>sizeof(recordtype); <ins class="diffchange diffchange-inline">sebagai ukuran </ins>record. <ins class="diffchange diffchange-inline">Jika anda mendefinisikan </ins>packed record, <ins class="diffchange diffchange-inline">coba untuk memastikan bahwa </ins>data <ins class="diffchange diffchange-inline">dijajarkan secara alami</ins>, <ins class="diffchange diffchange-inline">bila memungkinkan</ins>. <ins class="diffchange diffchange-inline">Beberapa prosesor hanya menjajarkan persyaratan untuk tipe </ins>data <ins class="diffchange diffchange-inline">tertentu</ins>, <ins class="diffchange diffchange-inline">seperti </ins>floating point (<ins class="diffchange diffchange-inline">misalnya PowerPC lama</ins>). </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">To check if the </del>CPU <del class="diffchange diffchange-inline">requires proper alignment</del>, <del class="diffchange diffchange-inline">check the </del>FPC_REQUIRES_PROPER_ALIGNMENT (<del class="diffchange diffchange-inline">version </del>1.9 <del class="diffchange diffchange-inline">and higher</del>) <del class="diffchange diffchange-inline">define</del>. <del class="diffchange diffchange-inline">On </del>32 Bit <del class="diffchange diffchange-inline">CPUs this usually means that </del>data <del class="diffchange diffchange-inline">up to a size of </del>4 <del class="diffchange diffchange-inline">must be naturally aligned</del>. <del class="diffchange diffchange-inline">If you want to access </del>unaligned <del class="diffchange diffchange-inline">data</del>, <del class="diffchange diffchange-inline">use the </del>[[move]] <del class="diffchange diffchange-inline">procedure to move it to an </del>aligned <del class="diffchange diffchange-inline">location before processing it</del>. <del class="diffchange diffchange-inline">The </del>move <del class="diffchange diffchange-inline">procedure takes care of </del>unaligned <del class="diffchange diffchange-inline">data and handles it properly</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Untuk memeriksa apakah </ins>CPU <ins class="diffchange diffchange-inline">memerlukan penjajaran yang benar</ins>, <ins class="diffchange diffchange-inline">periksa definisi </ins>FPC_REQUIRES_PROPER_ALIGNMENT (<ins class="diffchange diffchange-inline">versi </ins>1.9 <ins class="diffchange diffchange-inline">dan lebih tinggi</ins>). <ins class="diffchange diffchange-inline">Pada CPU </ins>32 Bit <ins class="diffchange diffchange-inline">ini biasanya berarti bahwa </ins>data <ins class="diffchange diffchange-inline">sampai ukuran </ins>4 <ins class="diffchange diffchange-inline">harus dijajarkan secara alami</ins>. <ins class="diffchange diffchange-inline">Jika anda ingin mengakses data </ins>unaligned, <ins class="diffchange diffchange-inline">gunakan prosedur </ins>[[move]] <ins class="diffchange diffchange-inline">untuk memindahkannya ke lokasi </ins>aligned <ins class="diffchange diffchange-inline">sebelum memprosesnya</ins>. <ins class="diffchange diffchange-inline">Prosedur </ins>move <ins class="diffchange diffchange-inline">memelihara data </ins>unaligned <ins class="diffchange diffchange-inline">dan menanganinya dengan benar</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">There are multiple strategies for aligning</del>:</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Ada multipel strategi untuk penjajaran</ins>:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">align every </del>field <del class="diffchange diffchange-inline">on a multiple of a certain value </del>(<del class="diffchange diffchange-inline">typically a power of two</del>, 1,2,4,8. 1 <del class="diffchange diffchange-inline">is equivalent to </del>"packed")</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">jajarkan setiap </ins>field <ins class="diffchange diffchange-inline">pada multipel nilai tertentu </ins>(<ins class="diffchange diffchange-inline">biasanya pangkat dua</ins>, 1,2,4,8. 1 <ins class="diffchange diffchange-inline">sama dengan </ins>"packed")</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">pad before every </del>field <del class="diffchange diffchange-inline">such that it is aligned on a multiple of its size </del>(<del class="diffchange diffchange-inline">so a </del>longint <del class="diffchange diffchange-inline">on </del>4, <del class="diffchange diffchange-inline">an </del>int64 <del class="diffchange diffchange-inline">on </del>8 bytes <del class="diffchange diffchange-inline">etc</del>). <del class="diffchange diffchange-inline">This is typically done by </del>C <del class="diffchange diffchange-inline">compiler</del>, <del class="diffchange diffchange-inline">which is why </del>FPC <del class="diffchange diffchange-inline">calls it </del>{$packrecords C}. </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">padatkan sebelum setiap </ins>field <ins class="diffchange diffchange-inline">yang dijajarkan pada multipel ukurannya </ins>(<ins class="diffchange diffchange-inline">maka </ins>longint <ins class="diffchange diffchange-inline">pada </ins>4, int64 <ins class="diffchange diffchange-inline">pada </ins>8 bytes <ins class="diffchange diffchange-inline">dll</ins>). <ins class="diffchange diffchange-inline">Ini biasanya dikerjakan oleh kompilator </ins>C, <ins class="diffchange diffchange-inline">yang mengapa </ins>FPC <ins class="diffchange diffchange-inline">memanggilnya </ins>{$packrecords C}. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>(<del class="diffchange diffchange-inline">For </del>[[array]]<del class="diffchange diffchange-inline">s or </del>[[nested record]]<del class="diffchange diffchange-inline">s</del>, <del class="diffchange diffchange-inline">the size of their largest </del>sub unit <del class="diffchange diffchange-inline">is used</del>)</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>(<ins class="diffchange diffchange-inline">Untuk </ins>[[array]] <ins class="diffchange diffchange-inline">atau </ins>[[nested record]], <ins class="diffchange diffchange-inline">ukuran </ins>sub unit <ins class="diffchange diffchange-inline">terbesarnya yang digunakan</ins>)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Mac OS X {$packrecords C} <del class="diffchange diffchange-inline">seems to pad the entire </del>record <del class="diffchange diffchange-inline">at the end to make it a certain size</del>. <del class="diffchange diffchange-inline">This is still being investigated</del>, <del class="diffchange diffchange-inline">and probably will be fixed in compiler</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Mac OS X {$packrecords C} <ins class="diffchange diffchange-inline">nampaknya memadatkan seluruh </ins>record <ins class="diffchange diffchange-inline">di akhir guna memastikan ukuran tertentu</ins>. <ins class="diffchange diffchange-inline">Ini masih diinvestigasi</ins>, <ins class="diffchange diffchange-inline">dan mungkin akan dibetulkan dalam kompilator</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 32 Bit vs. 64 Bit ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 32 Bit vs. 64 Bit ==</div></td></tr>
</table>
Adezm
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=24330&oldid=prev
Adezm: /* 32 Bit vs. 64 Bit */
2007-09-29T19:32:17Z
<p><span dir="auto"><span class="autocomment">32 Bit vs. 64 Bit</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:32, 29 September 2007</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l76" >Line 76:</td>
<td colspan="2" class="diff-lineno">Line 76:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 32 Bit vs. 64 Bit ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 32 Bit vs. 64 Bit ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">To achive maximum compatiblity with older code</del>, FPC <del class="diffchange diffchange-inline">doesn't change the size of predefined </del>data <del class="diffchange diffchange-inline">types like </del><tt>[[Integer|integer]]</tt>, <tt>[[longint]]</tt> <del class="diffchange diffchange-inline">or </del><tt>[[word]]</tt> <del class="diffchange diffchange-inline">when changing from </del>32 <del class="diffchange diffchange-inline">to </del>64 Bit. <del class="diffchange diffchange-inline">However</del>, <del class="diffchange diffchange-inline">the size of a </del>pointer <del class="diffchange diffchange-inline">is </del>8 <del class="diffchange diffchange-inline">bytes on a </del>64 bit <del class="diffchange diffchange-inline">architecture so constructs like </del><tt>longint([[pointer]](p))</tt> <del class="diffchange diffchange-inline">are doomed to crash on </del>64 bit <del class="diffchange diffchange-inline">architectures</del>. <del class="diffchange diffchange-inline">However</del>, <del class="diffchange diffchange-inline">to allow you to write portable code, the </del>FPC <del class="diffchange diffchange-inline">system unit introduces the types </del><tt>[[Ptrint|PtrInt]]</tt> <del class="diffchange diffchange-inline">and </del><tt>[[Ptruint|PtrUInt]]</tt> <del class="diffchange diffchange-inline">which are </del>signed <del class="diffchange diffchange-inline">and </del>unsigned <del class="diffchange diffchange-inline">integer data types with the same size as a </del>pointer.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Untuk mencapai kompatibilitas maksimum dengan kode lebih lama</ins>, FPC <ins class="diffchange diffchange-inline">tidak mengubah ukuran tipe </ins>data <ins class="diffchange diffchange-inline">yang sudah didefinisikan seperti </ins><tt>[[Integer|integer]]</tt>, <tt>[[longint]]</tt> <ins class="diffchange diffchange-inline">atau </ins><tt>[[word]]</tt> <ins class="diffchange diffchange-inline">ketika mengubah dari </ins>32 <ins class="diffchange diffchange-inline">ke </ins>64 Bit. <ins class="diffchange diffchange-inline">Akan tetapi</ins>, <ins class="diffchange diffchange-inline">ukuran </ins>pointer <ins class="diffchange diffchange-inline">adalah </ins>8 <ins class="diffchange diffchange-inline">byte pada arsitektur </ins>64 bit <ins class="diffchange diffchange-inline">maka membentuk seperti </ins><tt>longint([[pointer]](p))</tt> <ins class="diffchange diffchange-inline">pasti rusak pada arsitektur </ins>64 bit. <ins class="diffchange diffchange-inline">Untuk membolehkan anda menulis kode portabel</ins>, <ins class="diffchange diffchange-inline">unit system </ins>FPC <ins class="diffchange diffchange-inline">memperkenalkan tipe </ins><tt>[[Ptrint|PtrInt]]</tt> <ins class="diffchange diffchange-inline">dan </ins><tt>[[Ptruint|PtrUInt]]</tt> <ins class="diffchange diffchange-inline">yang adalah tipe data integer </ins>signed <ins class="diffchange diffchange-inline">dan </ins>unsigned <ins class="diffchange diffchange-inline">dengan ukuran yang sama sebagai sebuah </ins>pointer.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Keep in mind that the size change of the </del>"pointer" <del class="diffchange diffchange-inline">type also affects </del>record <del class="diffchange diffchange-inline">sizes</del>. <del class="diffchange diffchange-inline">If you allocate </del>records <del class="diffchange diffchange-inline">with fixed sizes</del>, <del class="diffchange diffchange-inline">and not with </del>[[new]] <del class="diffchange diffchange-inline">or with </del>[[getmem]] (<x>,[[sizeof]](<x>)), <del class="diffchange diffchange-inline">this will have to be fixed</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Harap diingat bahwa perubahan ukuran dari tipe </ins>"pointer" <ins class="diffchange diffchange-inline">juga mempengaruhi ukuran </ins>record. <ins class="diffchange diffchange-inline">Jika anda mengalokasikan </ins>records <ins class="diffchange diffchange-inline">dengan ukuran tetap</ins>, <ins class="diffchange diffchange-inline">dan tidak dengan </ins>[[new]] <ins class="diffchange diffchange-inline">atau dengan </ins>[[getmem]] (<x>,[[sizeof]](<x>)), <ins class="diffchange diffchange-inline">ini harus dibetulkan</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">This is in line with most open </del>Unix <del class="diffchange diffchange-inline">platforms</del>. <del class="diffchange diffchange-inline">In the commercial world</del>, <del class="diffchange diffchange-inline">there are some exceptions like </del>Tru64, <del class="diffchange diffchange-inline">with is </del>ILP64</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Ini adalah baris dengan platform </ins>Unix <ins class="diffchange diffchange-inline">paling terbuka</ins>. <ins class="diffchange diffchange-inline">Dalam dunia komersial</ins>, <ins class="diffchange diffchange-inline">ada beberapa kekecualian seperti </ins>Tru64, <ins class="diffchange diffchange-inline">yang adalah </ins>ILP64</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Konvensi pemanggilan ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Konvensi pemanggilan ==</div></td></tr>
</table>
Adezm
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=24329&oldid=prev
Adezm: /* Konvensi pemanggilan */
2007-09-29T19:25:47Z
<p><span dir="auto"><span class="autocomment">Konvensi pemanggilan</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:25, 29 September 2007</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l84" >Line 84:</td>
<td colspan="2" class="diff-lineno">Line 84:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Konvensi pemanggilan ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Konvensi pemanggilan ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">For </del>IBM 370 <del class="diffchange diffchange-inline">and </del>zSeries, <del class="diffchange diffchange-inline">see the </del>[[ZSeries]] <del class="diffchange diffchange-inline">page for further discussion</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">Untuk </ins>IBM 370 <ins class="diffchange diffchange-inline">dan </ins>zSeries, <ins class="diffchange diffchange-inline">lihat halaman </ins>[[ZSeries]] <ins class="diffchange diffchange-inline">untuk diskusi lebih jauh</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">In general avoid relying on </del>internal <del class="diffchange diffchange-inline">knowledge</del>, <del class="diffchange diffchange-inline">like if a pass by </del>const <del class="diffchange diffchange-inline">is on the </del>stack <del class="diffchange diffchange-inline">or by </del>value.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Secara umum, hindari ketergantungan pada pengetahuan </ins>internal, <ins class="diffchange diffchange-inline">seperti jika dikirimkan oleh </ins>const <ins class="diffchange diffchange-inline">pada </ins>stack <ins class="diffchange diffchange-inline">atau dengan </ins>value.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== x86 ===</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== x86 ===</div></td></tr>
</table>
Adezm
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=24328&oldid=prev
Adezm: /* Endianness */
2007-09-29T19:22:23Z
<p><span dir="auto"><span class="autocomment">Endianness</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:22, 29 September 2007</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l3" >Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Endianness ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Endianness ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Endianness <del class="diffchange diffchange-inline">is the way how values larger than a </del>[[Byte|byte]] (<del class="diffchange diffchange-inline">e.g. </del>16/32/64-bit</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Endianness <ins class="diffchange diffchange-inline">adalah cara bagaimana nilai lebih besar dari sebuah </ins>[[Byte|byte]] (<ins class="diffchange diffchange-inline">misalnya </ins>16/32/64-bit</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[Integer|integers]]) <del class="diffchange diffchange-inline">are stored by the processor</del>. </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[Integer|integers]]) <ins class="diffchange diffchange-inline">disimpan oleh prosesor</ins>. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Free Pascal <del class="diffchange diffchange-inline">supports processors with two types of </del>endianness:</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Free Pascal <ins class="diffchange diffchange-inline">mendukung prosesor dengan dua jenis </ins>endianness:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div># <del class="diffchange diffchange-inline">Store the lowest value on the lowest address</del>; longint(4) <del class="diffchange diffchange-inline">encoded as </del>04 00 00 00 (''[http://en.wikipedia.org/wiki/Little_endian little endian]'')</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div># <ins class="diffchange diffchange-inline">Menyimpan nilai terendah pada alamat terendah</ins>; longint(4) <ins class="diffchange diffchange-inline">dienkode sebagai </ins>04 00 00 00 (''[http://en.wikipedia.org/wiki/Little_endian little endian]'')</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div># <del class="diffchange diffchange-inline">Store the highest value on the lowest address</del>; longint(4) <del class="diffchange diffchange-inline">encoded as </del>00 00 00 04 (''[http://en.wikipedia.org/wiki/Big_endian big endian]'')</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div># <ins class="diffchange diffchange-inline">Menyimpan nilai tertingi pada alamat terendah</ins>; longint(4) <ins class="diffchange diffchange-inline">dienkode sebagai </ins>00 00 00 04 (''[http://en.wikipedia.org/wiki/Big_endian big endian]'')</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">side note</del>:</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">catatan samping</ins>:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Middle endian</del>, <del class="diffchange diffchange-inline">also called mixed </del>endian, <del class="diffchange diffchange-inline">processors are rare nowadays</del>. <del class="diffchange diffchange-inline">The best known</del>, <del class="diffchange diffchange-inline">but now historic</del>, <del class="diffchange diffchange-inline">middle </del>endian <del class="diffchange diffchange-inline">processor is the </del>[http://en.wikipedia.org/wiki/PDP-11 PDP-11] <del class="diffchange diffchange-inline">from </del>DEC.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Endian tengah</ins>, <ins class="diffchange diffchange-inline">juga disebut </ins>endian <ins class="diffchange diffchange-inline">campuran</ins>, <ins class="diffchange diffchange-inline">prosesor jarang sekarang</ins>. <ins class="diffchange diffchange-inline">Yang terkenal</ins>, <ins class="diffchange diffchange-inline">tapi sekarang menjadi historis</ins>, <ins class="diffchange diffchange-inline">prosesor </ins>endian <ins class="diffchange diffchange-inline">menengah adalah </ins>[http://en.wikipedia.org/wiki/PDP-11 PDP-11] <ins class="diffchange diffchange-inline">dari </ins>DEC.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Endianness <del class="diffchange diffchange-inline">is generally a given choice </del>per <del class="diffchange diffchange-inline">processor family</del>, <del class="diffchange diffchange-inline">but some families of processors can be either big </del>endian <del class="diffchange diffchange-inline">or little </del>endian <del class="diffchange diffchange-inline">depending on the </del>mainboard <del class="diffchange diffchange-inline">they are attached to </del>(ARM, PPC).</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Endianness <ins class="diffchange diffchange-inline">adalah pilihan umum yang diberikan </ins>per <ins class="diffchange diffchange-inline">keluarga prosesor</ins>, <ins class="diffchange diffchange-inline">tapi beberapa keluar prosesor dapat berupa </ins>endian <ins class="diffchange diffchange-inline">besar atau </ins>endian <ins class="diffchange diffchange-inline">kecil pada </ins>mainboard <ins class="diffchange diffchange-inline">yang disertakannya </ins>(ARM, PPC).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">The best known little </del>endian <del class="diffchange diffchange-inline">processor family is </del>x86, <del class="diffchange diffchange-inline">the processor family used in PCs</del>, <del class="diffchange diffchange-inline">and its brethren </del>x86-64. <del class="diffchange diffchange-inline">Typical big </del>endian <del class="diffchange diffchange-inline">processors are </del>PPC (<del class="diffchange diffchange-inline">usually</del>, <del class="diffchange diffchange-inline">see above note</del>), <del class="diffchange diffchange-inline">and </del>[http://en.wikipedia.org/wiki/68k m68k], <del class="diffchange diffchange-inline">many older systems such as the </del>[http://en.wikipedia.org/wiki/HP3000 HP3000] <del class="diffchange diffchange-inline">minicomputers</del>, <del class="diffchange diffchange-inline">and </del>mainframes <del class="diffchange diffchange-inline">such as the </del>[http://en.wikipedia.org/wiki/IBM_370 IBM 370] (Z <del class="diffchange diffchange-inline">series</del>).</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Prosesor </ins>endian <ins class="diffchange diffchange-inline">kecil yang paling terkenal adalah keluarga </ins>x86, <ins class="diffchange diffchange-inline">keluar prosesor yang digunakan dalam PC</ins>, <ins class="diffchange diffchange-inline">dan yang terbarunya </ins>x86-64. <ins class="diffchange diffchange-inline">Prosesor umum </ins>endian <ins class="diffchange diffchange-inline">besar adalah </ins>PPC (<ins class="diffchange diffchange-inline">biasanya</ins>, <ins class="diffchange diffchange-inline">lihat catatan di atas</ins>), <ins class="diffchange diffchange-inline">dan </ins>[http://en.wikipedia.org/wiki/68k m68k], <ins class="diffchange diffchange-inline">banyak sistem lebih lama seperti misalnya </ins>[http://en.wikipedia.org/wiki/HP3000 HP3000] <ins class="diffchange diffchange-inline">minikomputer</ins>, <ins class="diffchange diffchange-inline">dan </ins>mainframes <ins class="diffchange diffchange-inline">seperti </ins>[http://en.wikipedia.org/wiki/IBM_370 IBM 370] (<ins class="diffchange diffchange-inline">seri </ins>Z).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Since </del>TCP/IP <del class="diffchange diffchange-inline">specifies that all protocol </del>header <del class="diffchange diffchange-inline">structures that go over the wire should be big </del>endian, <del class="diffchange diffchange-inline">so this notation is sometimes also refered to as </del>''<del class="diffchange diffchange-inline">network order</del>''.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Karena </ins>TCP/IP <ins class="diffchange diffchange-inline">menetapkan bahwa semua struktur </ins>header <ins class="diffchange diffchange-inline">protokol yag bejalan di atas kawat harus </ins>endian <ins class="diffchange diffchange-inline">besar</ins>, <ins class="diffchange diffchange-inline">maka notasi ini kadang-kadang dirujuk sebagai </ins>''<ins class="diffchange diffchange-inline">urutan jaringan</ins>''.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Endianness <del class="diffchange diffchange-inline">is important </del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Endianness <ins class="diffchange diffchange-inline">adalah penting </ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div># <del class="diffchange diffchange-inline">when exchanging </del>data <del class="diffchange diffchange-inline">between different architectures</del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div># <ins class="diffchange diffchange-inline">ketika bertukar </ins>data <ins class="diffchange diffchange-inline">antara arsitektur yang bebeda</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div># <del class="diffchange diffchange-inline">when accessing </del>data <del class="diffchange diffchange-inline">sometimes as </del>(<del class="diffchange diffchange-inline">an </del>array <del class="diffchange diffchange-inline">of</del>) <del class="diffchange diffchange-inline">a larger type</del>, <del class="diffchange diffchange-inline">like </del>integer, <del class="diffchange diffchange-inline">and sometimes as </del>(<del class="diffchange diffchange-inline">an </del>array <del class="diffchange diffchange-inline">of</del>) <del class="diffchange diffchange-inline">a </del>byte.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div># <ins class="diffchange diffchange-inline">ketika mengakses </ins>data <ins class="diffchange diffchange-inline">kadang-kadang sebagai </ins>(<ins class="diffchange diffchange-inline">sebuah </ins>array <ins class="diffchange diffchange-inline">dari</ins>) <ins class="diffchange diffchange-inline">tipe lebih besar</ins>, <ins class="diffchange diffchange-inline">seperti </ins>integer, <ins class="diffchange diffchange-inline">dan kadangkala sebagai </ins>(<ins class="diffchange diffchange-inline">sebuah </ins>array <ins class="diffchange diffchange-inline">dari</ins>) byte.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">An example of the latter</del>:</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Contoh yang terakhir</ins>:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><TT></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><TT></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l56" >Line 56:</td>
<td colspan="2" class="diff-lineno">Line 56:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></tt></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></tt></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">On little </del>endian <del class="diffchange diffchange-inline">machines </del>(PCs), <del class="diffchange diffchange-inline">the above code will write </del>5 (<del class="diffchange diffchange-inline">since </del>longint(5) <del class="diffchange diffchange-inline">is stored as </del>05 00 00 00 <del class="diffchange diffchange-inline">in memory</del>), <del class="diffchange diffchange-inline">while on big </del>endian <del class="diffchange diffchange-inline">machines </del>(<del class="diffchange diffchange-inline">e.g. </del>Powermacs) <del class="diffchange diffchange-inline">it will write </del>0 (<del class="diffchange diffchange-inline">since </del>longint(5) <del class="diffchange diffchange-inline">is stored as </del>00 00 00 05 <del class="diffchange diffchange-inline">in memory</del>). (<del class="diffchange diffchange-inline">If you get the report your machine is indeterminate</del>, <del class="diffchange diffchange-inline">please report on this </del>wiki <del class="diffchange diffchange-inline">page what processor does this and what you get</del>!)</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Pada mesin </ins>endian <ins class="diffchange diffchange-inline">kecil </ins>(PCs), <ins class="diffchange diffchange-inline">kode di atas akan menulis </ins>5 (<ins class="diffchange diffchange-inline">karena </ins>longint(5) <ins class="diffchange diffchange-inline">disimpan sebagai </ins>05 00 00 00 <ins class="diffchange diffchange-inline">dalam memori</ins>), <ins class="diffchange diffchange-inline">sementara pada mesin </ins>endian <ins class="diffchange diffchange-inline">besar </ins>(<ins class="diffchange diffchange-inline">contohnya </ins>Powermacs) <ins class="diffchange diffchange-inline">ia akan menulis </ins>0 (<ins class="diffchange diffchange-inline">karena </ins>longint(5) <ins class="diffchange diffchange-inline">disimpan sebagai </ins>00 00 00 05 <ins class="diffchange diffchange-inline">dalam memori</ins>). (<ins class="diffchange diffchange-inline">Jika anda mendapatkan laporan mesin anda adalah menengah</ins>, <ins class="diffchange diffchange-inline">silahkan laporkan pada halaman </ins>wiki <ins class="diffchange diffchange-inline">ini apa yang tidak didapatkan dan didapatkan prosesor ini</ins>!)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">To determine the </del>endianness <del class="diffchange diffchange-inline">of the processor</del>, <del class="diffchange diffchange-inline">use the </del>ENDIAN_BIG <del class="diffchange diffchange-inline">or </del>ENDIAN_LITTLE (<del class="diffchange diffchange-inline">or </del>FPC_LITTLE_ENDIAN <del class="diffchange diffchange-inline">and </del>FPC_BIG_ENDIAN <del class="diffchange diffchange-inline">starting from version </del>1.9) <del class="diffchange diffchange-inline">defines that are defined by </del>freepascal <del class="diffchange diffchange-inline">automatically depending on the processor</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Untuk menentukan </ins>endianness <ins class="diffchange diffchange-inline">dari sebuah prosesor</ins>, <ins class="diffchange diffchange-inline">gunakan </ins>ENDIAN_BIG <ins class="diffchange diffchange-inline">atau </ins>ENDIAN_LITTLE (<ins class="diffchange diffchange-inline">atau </ins>FPC_LITTLE_ENDIAN <ins class="diffchange diffchange-inline">dan </ins>FPC_BIG_ENDIAN <ins class="diffchange diffchange-inline">mulai dari versi </ins>1.9) <ins class="diffchange diffchange-inline">mendefinisikan bahwa didefinisikan oleh </ins>freepascal <ins class="diffchange diffchange-inline">secara otomatis tergantung pada prosesor</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Penjajaran ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Penjajaran ==</div></td></tr>
</table>
Adezm
https://wiki.freepascal.org/index.php?title=Writing_portable_code_regarding_the_processor_architecture/id&diff=24327&oldid=prev
Adezm: New page: Ada beberapa isu utama saat menulis kode yang portabel sehubungan dengan arsitektur prosesor: endianness dan prosesor 32 vs. 64 bit. == Endianness == Endianness is the way...
2007-09-29T18:51:02Z
<p>New page: Ada beberapa isu utama saat menulis kode yang portabel sehubungan dengan arsitektur prosesor: endianness dan prosesor <a href="/32_bit" title="32 bit">32</a> vs. <a href="/64_bit" title="64 bit">64 bit</a>. == Endianness == Endianness is the way...</p>
<p><b>New page</b></p><div>Ada beberapa isu utama saat menulis kode yang portabel sehubungan dengan arsitektur prosesor: endianness dan prosesor [[32 bit|32]] vs. [[64 bit]].<br />
<br />
== Endianness ==<br />
<br />
Endianness is the way how values larger than a [[Byte|byte]] (e.g. 16/32/64-bit<br />
[[Integer|integers]]) are stored by the processor. <br />
<br />
Free Pascal supports processors with two types of endianness:<br />
<br />
# Store the lowest value on the lowest address; longint(4) encoded as 04 00 00 00 (''[http://en.wikipedia.org/wiki/Little_endian little endian]'')<br />
# Store the highest value on the lowest address; longint(4) encoded as 00 00 00 04 (''[http://en.wikipedia.org/wiki/Big_endian big endian]'')<br />
<br />
side note:<br />
<br />
Middle endian, also called mixed endian, processors are rare nowadays. The best known, but now historic, middle endian processor is the [http://en.wikipedia.org/wiki/PDP-11 PDP-11] from DEC.<br />
<br />
Endianness is generally a given choice per processor family, but some families of processors can be either big endian or little endian depending on the mainboard they are attached to (ARM, PPC).<br />
<br />
The best known little endian processor family is x86, the processor family used in PCs, and its brethren x86-64. Typical big endian processors are PPC (usually, see above note), and [http://en.wikipedia.org/wiki/68k m68k], many older systems such as the [http://en.wikipedia.org/wiki/HP3000 HP3000] minicomputers, and mainframes such as the [http://en.wikipedia.org/wiki/IBM_370 IBM 370] (Z series).<br />
<br />
Since TCP/IP specifies that all protocol header structures that go over the wire should be big endian, so this notation is sometimes also refered to as ''network order''.<br />
<br />
Endianness is important <br />
# when exchanging data between different architectures<br />
# when accessing data sometimes as (an array of) a larger type, like integer, and sometimes as (an array of) a byte.<br />
<br />
An example of the latter:<br />
<br />
<TT><br />
: Type<br />
:{{Tab4}} Q = RECORD<br />
:{{Tab8}} case boolean of<br />
:{{Tab12}} true: (i:integer);<br />
:{{Tab12}} false: (p:array[1..4] of byte) <br />
:{{Tab4}} END;<br />
<br />
: Var x:^Q ;<br />
<br />
: begin<br />
:{{Tab4}} new(x);<br />
:{{Tab4}} x^.i:=5;<br />
:{{Tab4}} if x^.p[1]=5 then<br />
:{{Tab8}} writeln(x^.p[1],' Your machine is Little Endian')<br />
:{{Tab4}} else<br />
:{{Tab8}} if x^.p[4]=5 then<br />
:{{Tab12}} writeln(x^.p[1],' Your machine is Big Endian')<br />
:{{Tab8}} else<br />
:{{Tab12}} writeln(x^.p[1],' ',x^.p[2],' ',x^.p[3],' ',x^.p[4],' Your machine&#39;&#39;s endianness is indeterminate; please report the results to the compiler development team'); <br />
:{{Tab4}} writeln;<br />
<br />
:{{Tab4}}{Make it wait so we can see the results }<br />
<br />
:{{Tab4}} write('Press enter when you finish reading this ');<br />
:{{Tab4}} readln;<br />
: end.<br />
<br />
</tt><br />
On little endian machines (PCs), the above code will write 5 (since longint(5) is stored as 05 00 00 00 in memory), while on big endian machines (e.g. Powermacs) it will write 0 (since longint(5) is stored as 00 00 00 05 in memory). (If you get the report your machine is indeterminate, please report on this wiki page what processor does this and what you get!)<br />
<br />
To determine the endianness of the processor, use the ENDIAN_BIG or ENDIAN_LITTLE (or FPC_LITTLE_ENDIAN and FPC_BIG_ENDIAN starting from version 1.9) defines that are defined by freepascal automatically depending on the processor.<br />
<br />
== Penjajaran ==<br />
<br />
Some processors will allow improperly aligned data but with reduced efficiency (IBM 370/zSeries). Some processors generate hardware processor exceptions when data is badly aligned (e.g. Alpha or ARM). Sometimes the hardware exceptions are caught and fixed using emulation by the OS, but this is very slow, and should be avoided. This can also cause records to have different sizes, so always use sizeof(recordtype); as size of a record. If you define a packed record, try to ensure that data is naturally aligned, if possible. Some processors only have alignment requirements for certain types of data, like floating point (e.g. older PowerPCs). <br />
<br />
To check if the CPU requires proper alignment, check the FPC_REQUIRES_PROPER_ALIGNMENT (version 1.9 and higher) define. On 32 Bit CPUs this usually means that data up to a size of 4 must be naturally aligned. If you want to access unaligned data, use the [[move]] procedure to move it to an aligned location before processing it. The move procedure takes care of unaligned data and handles it properly.<br />
<br />
There are multiple strategies for aligning:<br />
* align every field on a multiple of a certain value (typically a power of two, 1,2,4,8. 1 is equivalent to "packed")<br />
* pad before every field such that it is aligned on a multiple of its size (so a longint on 4, an int64 on 8 bytes etc). This is typically done by C compiler, which is why FPC calls it {$packrecords C}. <br />
<br />
(For [[array]]s or [[nested record]]s, the size of their largest sub unit is used)<br />
<br />
Mac OS X {$packrecords C} seems to pad the entire record at the end to make it a certain size. This is still being investigated, and probably will be fixed in compiler.<br />
<br />
== 32 Bit vs. 64 Bit ==<br />
<br />
To achive maximum compatiblity with older code, FPC doesn't change the size of predefined data types like <tt>[[Integer|integer]]</tt>, <tt>[[longint]]</tt> or <tt>[[word]]</tt> when changing from 32 to 64 Bit. However, the size of a pointer is 8 bytes on a 64 bit architecture so constructs like <tt>longint([[pointer]](p))</tt> are doomed to crash on 64 bit architectures. However, to allow you to write portable code, the FPC system unit introduces the types <tt>[[Ptrint|PtrInt]]</tt> and <tt>[[Ptruint|PtrUInt]]</tt> which are signed and unsigned integer data types with the same size as a pointer.<br />
<br />
Keep in mind that the size change of the "pointer" type also affects record sizes. If you allocate records with fixed sizes, and not with [[new]] or with [[getmem]] (<x>,[[sizeof]](<x>)), this will have to be fixed.<br />
<br />
This is in line with most open Unix platforms. In the commercial world, there are some exceptions like Tru64, with is ILP64<br />
<br />
== Konvensi pemanggilan ==<br />
<br />
* For IBM 370 and zSeries, see the [[ZSeries]] page for further discussion.<br />
<br />
In general avoid relying on internal knowledge, like if a pass by const is on the stack or by value.<br />
<br />
=== x86 ===<br />
=== ARM ===<br />
=== 68K ===<br />
<br />
<br />
<br />
{{Data types}}</div>
Adezm