From: <cad...@li...> - 2005-11-21 05:03:07
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml"> <head><style type=3D"text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: = #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li { font-family: verdana,arial,helvetica= ,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; fo= nt-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padd= ing: 6px; } #msg ul, pre { overflow: auto; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt= ;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:aut= o;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patc= h .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 = 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 = 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[262] tiki/include/Tiki: Tiki: Add endian.h for converting from li= ttle-endian input data (and more</title> </head> <body> <div id=3D"msg"> <dl> <dt>Revision</dt> <dd>262</dd> <dt>Author</dt> <dd>bard</dd> <dt>Date</dt> <dd>2005-11-20 20:55:17 -0800 (Sun, 20 Nov 2005)</dd> </dl> <h3>Log Message</h3> <pre>Tiki: Add endian.h for converting from little-endian input data (and= more to come later I assume...)</pre> <h3>Modified Paths</h3> <ul> <li><a href=3D"#tikiincludeTikiTikiAllh">tiki/include/Tiki/TikiAll.h</a><= /li> </ul> <h3>Added Paths</h3> <ul> <li><a href=3D"#tikiincludeTikiendianh">tiki/include/Tiki/endian.h</a></l= i> </ul> </div> <div id=3D"patch"> <h3>Diff</h3> <a id=3D"tikiincludeTikiTikiAllh"></a> <div class=3D"modfile"><h4>Modified: tiki/include/Tiki/TikiAll.h (261 =3D= > 262)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/include/Tiki/TikiAll.h 2005-11-21 01:19:47 = UTC (rev 261) +++ tiki/include/Tiki/TikiAll.h 2005-11-21 04:55:17 UTC (rev 262) </span><span class=3D"lines">@@ -11,6 +11,7 @@ </span><span class=3D"cx"> #include <Tiki/drawables/banner.h> </span><span class=3D"cx"> #include <Tiki/drawables/label.h> </span><span class=3D"cx"> #include <Tiki/drawables/layer.h> </span><ins>+#include <Tiki/endian.h> </ins><span class=3D"cx"> #include <Tiki/eventcollector.h> </span><span class=3D"cx"> #include <Tiki/file.h> </span><span class=3D"cx"> #include <Tiki/font.h> </span></pre></div> <a id=3D"tikiincludeTikiendianh"></a> <div class=3D"addfile"><h4>Added: tiki/include/Tiki/endian.h (261 =3D> 26= 2)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/include/Tiki/endian.h 2005-11-21 01:19:47 U= TC (rev 261) +++ tiki/include/Tiki/endian.h 2005-11-21 04:55:17 UTC (rev 262) </span><span class=3D"lines">@@ -0,0 +1,67 @@ </span><ins>+/* + Tiki + =20 + endian.h + + Copyright (C)2005 Dan Potter +*/ + +#ifndef __TIKI_ENDIAN_H +#define __TIKI_ENDIAN_H + +#include <machine/endian.h> + +namespace Tiki { +namespace Endian { + +static inline uint16 swap(uint16 src) { + src =3D ((src & 0xff00) >> 8) + | ((src & 0x00ff) << 8); + return src; +} + +static inline uint32 swap(uint32 src) { + src =3D ((src & 0x000000ff) << 24) + | ((src & 0x0000ff00) << 8) + | ((src & 0x00ff0000) >> 8) + | ((src & 0xff000000) >> 24); + return src; +} + +static inline uint16 convertFromLe(uint16 src) { +#if BYTE_ORDER =3D=3D BIG_ENDIAN + return swap(src); +#else + return src; +#endif +} + +static inline uint32 convertFromLe(uint32 src) { +#if BYTE_ORDER =3D=3D BIG_ENDIAN + return swap(src); +#else + return src; +#endif +} + +static inline uint16 convertFromBe(uint16 src) { +#if BYTE_ORDER =3D=3D BIG_ENDIAN + return src; +#else + return swap(src); +#endif +} + +static inline uint32 convertFromBe(uint32 src) { +#if BYTE_ORDER =3D=3D BIG_ENDIAN + return src; +#else + return swap(src); +#endif +} + +} +} + +#endif // __TIKI_ENDIAN_H + </ins></pre> </div> </div> </body> </html> |