Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Big endian float value - hot to in Delphi (https://www.delphipraxis.net/166527-big-endian-float-value-hot-delphi.html)

WojTec 16. Feb 2012 17:15

Delphi-Version: 2010

Big endian float value - hot to in Delphi
 
I'm trying read ASE file, unfortunately it storing color values in BE Float32. I added Float32 = Single. Now I have to make little endian from it. How to do it?

BUG 17. Feb 2012 02:10

AW: Big endian float value - hot to in Delphi
 

WojTec 17. Feb 2012 12:40

Re: Big endian float value - hot to in Delphi
 
I wrote this, could you confirm is it valid?

Delphi-Quellcode:
function ChangeEndian32f(X: Single): Single;
var
  B: packed array [0..3] of Byte absolute X;
  L: packed array [0..3] of Byte;
  I: Integer;
begin
  for I := 0 to 3 do
    L[I] := B[3 - I]
  ;

  Result := Single(L);
end;
I also found this:

Code:
http://edn.embarcadero.com/article/28964
How it working? I don't understand that record?

BUG 17. Feb 2012 14:21

AW: Big endian float value - hot to in Delphi
 
Zitat:

Zitat von WojTec (Beitrag 1151611)
I wrote this, could you confirm is it valid?

It looks good to me.

Zitat:

Zitat von WojTec (Beitrag 1151611)
I also found this:

http://edn.embarcadero.com/article/28964

How it working? I don't understand that record?

These records are called variant record and can be used similar to unions in C/C++.


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:12 Uhr.

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