AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Visual Basic zu Delphi

Ein Thema von skoschke · begonnen am 23. Feb 2023 · letzter Beitrag vom 24. Feb 2023
 
Benutzerbild von Phoenix
Phoenix
(Moderator)

Registriert seit: 25. Jun 2002
Ort: Hausach
7.644 Beiträge
 
#3

AW: Visual Basic zu Delphi

  Alt 23. Feb 2023, 12:56
Mal ChatGPT gefragt:

Zitat von Phoenix:
This code block is visual basic:

begin
crc := (crc >> 8) Xor crc16tab((crc Xor CByte(Asc(ch))) And &HFF);
end;

Please translate this to Delphi code.
Zitat von ChatGPT:
Sure! Here is the equivalent Delphi code for the provided Visual Basic code block:
Code:
crc := (crc shr 8) xor crc16tab[(crc xor Byte(Ord(ch))) and $FF];
Assuming crc is a 16-bit unsigned integer variable, and crc16tab is an array of 256 16-bit unsigned integers.

Note that shr is the Delphi equivalent of the >> right-shift operator in Visual Basic. Byte(Ord(ch)) is used to convert the ASCII character ch to a byte value, which is required by the crc16tab array. The $FF hexadecimal value is used to perform a bitwise AND operation with the byte value, ensuring that only the lower 8 bits are used in the computation.
Irgendwie cool. Und erschreckend. Ich habe ihm die Tabelle ja nicht mitgegeben, aber das Ding "rät" das es die Tabelle sein muss.
Sebastian Gingter
Phoenix - 不死鳥, Microsoft MVP, Rettungshundeführer
Über mich: Sebastian Gingter @ Thinktecture Mein Blog: https://gingter.org
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:51 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz