joaopauloschuler / neural-api

CAI NEURAL API - Pascal based deep learning neural network API optimized for AVX, AVX2 and AVX512 instruction sets plus OpenCL capable devices including AMD, Intel and NVIDIA.
GNU Lesser General Public License v2.1
356 stars 195 forks source link

Delphi Swap Endian #19

Closed Pigrecos closed 4 years ago

Pigrecos commented 4 years ago

There is a small error in the delphi function

I corrected it like this:

{$IFNDEF FPC} function SwapEndian(I:integer):integer; begin // valid for SmallInt // result := Swap(I) Result := ((Swap(Smallint(I)) and $ffff) shl $10) or (Swap(Smallint(I shr $10)) and $ffff) end; {$ENDIF}

https://github.com/Pigrecos/neural-api/blob/fa2c0f180a1fd2ce239f908cb7419e8c21380676/neural/neuraldatasets.pas#L217

joaopauloschuler commented 4 years ago

Thank you for reporting. Has your fix been tested with 32 or 64 bits?

Pigrecos commented 4 years ago

I tested on x32 and x64 and everything is ok.

joaopauloschuler commented 4 years ago

If you merge most recent commits into your fork and if all is good, maybe the best path is me merging back your changes.

joaopauloschuler commented 4 years ago

Solved with most recent merge. Thank you.