Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi CPP -> Delphi (https://www.delphipraxis.net/158887-cpp-delphi.html)

Gehstock 6. Mär 2011 20:05

Delphi-Version: 5

CPP -> Delphi
 
wie würdet ihr die Folgende Zeile Übersetzen mich verwirrt sie etwas

Code:
for (b = ~b & 0x3FFFFFFF; a >= 8; a -= 8, buffer++)

implementation 6. Mär 2011 20:39

AW: CPP -> Delphi
 
Code:
for (b = ~b & 0x3FFFFFFF; a >= 8; a -= 8, buffer++)
Vielleicht so:
Delphi-Quellcode:
var
  buffer, a, b: integer;
begin
  b := (not b) and $3FFFFFFF;
  while a >= 8 do begin
    ...
    Dec(a,8);
    Inc(buffer);
  end;
end;

Assarbad 6. Mär 2011 20:47

AW: CPP -> Delphi
 
buffer ist ziemlich sicher kein Integer. Vermutlich PAnsiChar oder sowas ...

implementation 6. Mär 2011 20:50

AW: CPP -> Delphi
 
Zitat:

Zitat von Assarbad (Beitrag 1086310)
buffer ist ziemlich sicher kein Integer. Vermutlich PAnsiChar oder sowas ...

Das wird wohl im C++-Quellcode drinstehen. Ging ja erstmal um die Zeile.

Assarbad 6. Mär 2011 23:00

AW: CPP -> Delphi
 
Zitat:

Zitat von implementation (Beitrag 1086311)
Das wird wohl im C++-Quellcode drinstehen. Ging ja erstmal um die Zeile.

Und mit ging es darum, daß du buffer als Integer deklariert hast :zwinker:

Gehstock 6. Mär 2011 23:38

AW: CPP -> Delphi
 
Danke ihr beiden,
Assarbad hat recht ist ein PAnsiChar
und wie übersetz ich das
Code:
if ( ((a ^ data) & (1L << 29)) != 0 )

Delphi-Quellcode:
var
ll : LongInt;

if not((a Xor data) and (SizeOf(ll) SHL 29)) = 0 then
so in etwa?

Assarbad 7. Mär 2011 00:52

AW: CPP -> Delphi
 
Zitat:

Zitat von Gehstock (Beitrag 1086334)
Delphi-Quellcode:
var
ll : LongInt;

if not((a Xor data) and (SizeOf(ll) SHL 29)) = 0 then
so in etwa?

Neee ...

Delphi-Quellcode:
if ((a xor data) and (1 shl 29)) <> 0 then

Phoenix 7. Mär 2011 06:08

AW: CPP -> Delphi
 
sizeof longint ist 1??

Gehstock 7. Mär 2011 08:14

AW: CPP -> Delphi
 
Also doch richtig?

himitsu 7. Mär 2011 08:24

AW: CPP -> Delphi
 
Das L kannst'e in Delphi ignorieren.

Und um deine letzte Frage zu beantworten:
Wieviele Bytes ist ein LongInt groß?


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:41 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz