From tokoe82@yahoo.de Sat Mar 18 20:49:28 2000 From: Tobias Koenig To: lug-dd@mailman.schlittermann.de Subject: [Lug-dd] C-Frage Date: Thu, 16 Mar 2000 18:33:15 +0100 Message-ID: <00031618350404.00495@P200> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1256415284207164773==" --===============1256415284207164773== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Hallo, Kann mir jemand sagen, wie man unter C bei der Zahl 61696 das höherwertige mit dem niederwertigen Byte vertauscht ??? Ciao, Tobias -- Software is like sex: It's better when it's free Linus Torvalds __________________________________________________________________ Do You Yahoo!? Gesendet von Yahoo! Mail - http://mail.yahoo.de Yahoo! Auktionen - gleich ausprobieren - http://auktionen.yahoo.de --===============1256415284207164773==-- From heiko@schlittermann.de Sat Mar 18 21:31:59 2000 From: Heiko Schlittermann To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Sat, 18 Mar 2000 21:29:06 +0100 Message-ID: <20000318212906.B3249@schlittermann.de> In-Reply-To: <00031618350404.00495@P200> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2872102864591191788==" --===============2872102864591191788== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Thu, Mar 16, 2000 at 06:33:15PM +0100, Tobias Koenig wrote: : Hallo, : : Kann mir jemand sagen, wie man unter C bei der Zahl 61696 das : höherwertige mit dem niederwertigen Byte vertauscht ??? x = 61696; x &= 0xffff; /* damit es wirklich nur zwei byte sind */ x = (x >> 8) & 0 | (x << 8); /* ich weiss jetzt nur nicht, ob die shifts mit vorzeichen sind oder nicht. */ /* eventuell: x = (0xff & (x >> 8)) | (0xff00 & (x << 8)); */ Es gibt sicher (!) etwas effizienteres .. swab() oder so aehnlich. Ja -- man swab #include int x = 61696; int y; swab(&x, &y, sizeof(x)); Best regards from Dresden/Germany Viele Gruesse aus Dresden Heiko Schlittermann -- SCHLITTERMANN --------------------- internet & unix support - Debian 2.x CD Heiko Schlittermann HS12-RIPE finger:heiko(a)schlittermann.de - pgp: A1 7D F6 7B 69 73 48 35 E1 DE 21 A7 A8 9A 77 92 ------- --===============2872102864591191788==-- From ulrich.kuettler@mailbox.tu-dresden.de Mon Mar 20 22:30:02 2000 From: Ulrich =?utf-8?q?K=C3=BCttler?= To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Mon, 20 Mar 2000 22:27:56 +0100 Message-ID: <38D697DC.A9573E96@brother.big> In-Reply-To: <00031618350404.00495@P200> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5376412663671939388==" --===============5376412663671939388== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Tobias Koenig wrote: > > Hallo, > > Kann mir jemand sagen, wie man unter C bei der Zahl 61696 das > höherwertige mit dem niederwertigen Byte vertauscht ??? > Ich stelle mir das so vor. Sollte funktionieren, wenn mit Nullen aufgefuellt wird. (Aber soviel ich weiss garantiert das keiner (?)) #define SWAPBYTES(c) (((c)>>8) & ((c)<<8)) Uli --===============5376412663671939388==-- From holger.dietze@advis.de Mon Mar 20 23:14:25 2000 From: Holger Dietze To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Mon, 20 Mar 2000 23:15:38 +0100 Message-ID: In-Reply-To: <38D697DC.A9573E96@brother.big> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1230652903398702243==" --===============1230652903398702243== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Ulrich =?iso-8859-1?Q?K=FCttler?= schrieb: > Ich stelle mir das so vor. Sollte funktionieren, wenn mit Nullen > aufgefuellt wird. (Aber soviel ich weiss garantiert das keiner (?)) > > #define SWAPBYTES(c) (((c)>>8) & ((c)<<8)) s/&/|/ Funktioniert auf einem 32-Bit-System dann aber nur, wenn Du Dich nicht fuer die hoeherwertigen 16 Bits interessierst (da kommen die Bits 8-15 auch hin). Holger -- Holger Dietze, email: holger.dietze(a)advis.de "The more data I punch in this card, the lighter it becomes, and the lower the mailing cost." -- Stan Kelly-Bootle, "The Devil's DP Dictionary" --===============1230652903398702243==-- From tokoe82@yahoo.de Tue Mar 21 20:28:12 2000 From: Tobias Koenig To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Sun, 19 Mar 2000 12:21:37 +0100 Message-ID: <00031912234601.00409@P200> In-Reply-To: <38D697DC.A9573E96@brother.big> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4289422977352199410==" --===============4289422977352199410== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Am Mon, 20 Mär 2000 schrieb Ulrich Küttler: > Ich stelle mir das so vor. Sollte funktionieren, wenn mit Nullen > aufgefuellt wird. (Aber soviel ich weiss garantiert das keiner (?)) > > #define SWAPBYTES(c) (((c)>>8) & ((c)<<8)) Der Vorschlag von Heiko hat wunderbar funktioniert, trotzdem Danke für deinen Tip. Ciao, Tobias -- Software is like sex: It's better when it's free Linus Torvalds __________________________________________________________________ Do You Yahoo!? Gesendet von Yahoo! Mail - http://mail.yahoo.de Yahoo! Auktionen - gleich ausprobieren - http://auktionen.yahoo.de --===============4289422977352199410==-- From eric@gixgax.de Sat Jun 26 18:07:34 2004 From: Eric Schaefer To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Sat, 26 Jun 2004 18:08:01 +0000 Message-ID: <1088266083.6773.8.camel@zeus.gixgax.de> In-Reply-To: <00031618350404.00495@P200> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7926891530359423269==" --===============7926891530359423269== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Thu, 2000-03-16 at 18:33, Tobias Koenig wrote: > Kann mir jemand sagen, wie man unter C bei der Zahl 61696 das > höherwertige mit dem niederwertigen Byte vertauscht ??? So: 241 Im Ernst: unsigned short drehrumbumm(unsigned short x) { return (x >> 8) | ((x & 0x00FF) << 8); } Eric --===============7926891530359423269==-- From eric@gixgax.de Sat Jun 26 19:13:05 2004 From: Eric Schaefer To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Sat, 26 Jun 2004 19:14:01 +0000 Message-ID: <1088270027.6773.12.camel@zeus.gixgax.de> In-Reply-To: <00031618350404.00495@P200> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2034307706397341465==" --===============2034307706397341465== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Thu, 2000-03-16 at 18:33, Tobias Koenig wrote: ^^^^^^^^^^ Hmmm. Aus irgendwelchen Gründen ist die bei mir als ungelesen markiert gewesen und ich habe dazu auch keine Antworten in meinem Archiv, weshalb ich blind geantwortet habe. Sehr komisch. Naja, vielleicht hilft es Tobias ja trotzdem ;-) Eric --===============2034307706397341465==-- From tokoe@kde.org Sun Jun 27 18:46:00 2004 From: Tobias Koenig To: lug-dd@mailman.schlittermann.de Subject: Re: [Lug-dd] C-Frage Date: Sun, 27 Jun 2004 18:46:02 +0000 Message-ID: <20040627164600.GA1003@ghostdog.localnet> In-Reply-To: <1088270027.6773.12.camel@zeus.gixgax.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2485293285910604669==" --===============2485293285910604669== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Sat, Jun 26, 2004 at 07:13:47PM +0200, Eric Schaefer wrote: > On Thu, 2000-03-16 at 18:33, Tobias Koenig wrote: Hi Eric, > Hmmm. Aus irgendwelchen Gründen ist die bei mir als ungelesen markiert > gewesen und ich habe dazu auch keine Antworten in meinem Archiv, weshalb > ich blind geantwortet habe. Sehr komisch. > > Naja, vielleicht hilft es Tobias ja trotzdem ;-) Hmm, wenn du mir jetzt noch verraten könntest was ich damals eigentlich machen wollte vielleicht... ;) Ciao, Tobias -- Separate politics from religion and economy! --===============2485293285910604669== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEuMi40IChHTlUv TGludXgpCgppRDhEQlFGQTN2bklTdkZVS3BZNlZMQVJBai9hQUtDMzNCTGxLcnFiUVQ4VGNtYlJG WW9KU2hjQm53Q2dxeWI5CjhhdzYvQ0RFWnpLc0VHaStYNHJiaXJvPQo9OWRSagotLS0tLUVORCBQ R1AgU0lHTkFUVVJFLS0tLS0K --===============2485293285910604669==--