@@ -997,6 +997,79 @@ function SDL_toupper(x: cint): cint; cdecl;
997
997
function SDL_tolower (x: cint): cint; cdecl;
998
998
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name ' _SDL_tolower' {$ENDIF} {$ENDIF};
999
999
1000
+ (* -- Hash functions -- *)
1001
+
1002
+ {*
1003
+ * Calculate a CRC-16 value.
1004
+ *
1005
+ * https:// en.wikipedia.org/wiki/Cyclic_redundancy_check
1006
+ *
1007
+ * This function can be called multiple times, to stream data to be
1008
+ * checksummed in blocks. Each call must provide the previous CRC-16 return
1009
+ * value to be updated with the next block. The first call to this function
1010
+ * for a set of blocks should pass in a zero CRC value.
1011
+ *
1012
+ * \param crc the current checksum for this data set, or 0 for a new data set.
1013
+ * \param data a new block of data to add to the checksum.
1014
+ * \param len the size, in bytes, of the new block of data.
1015
+ * \returns a CRC-16 checksum value of all blocks in the data set.
1016
+ *
1017
+ * \threadsafety It is safe to call this function from any thread.
1018
+ *
1019
+ * \since This function is available since SDL 3.2.0 .
1020
+ *}
1021
+ function SDL_crc16 (crc: cuint16; const data: Pointer; len: csize_t ): cuint16; cdecl;
1022
+ external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name ' _SDL_crc16' {$ENDIF} {$ENDIF};
1023
+
1024
+ {*
1025
+ * Calculate a CRC-32 value.
1026
+ *
1027
+ * https:// en.wikipedia.org/wiki/Cyclic_redundancy_check
1028
+ *
1029
+ * This function can be called multiple times, to stream data to be
1030
+ * checksummed in blocks. Each call must provide the previous CRC-32 return
1031
+ * value to be updated with the next block. The first call to this function
1032
+ * for a set of blocks should pass in a zero CRC value.
1033
+ *
1034
+ * \param crc the current checksum for this data set, or 0 for a new data set.
1035
+ * \param data a new block of data to add to the checksum.
1036
+ * \param len the size, in bytes, of the new block of data.
1037
+ * \returns a CRC-32 checksum value of all blocks in the data set.
1038
+ *
1039
+ * \threadsafety It is safe to call this function from any thread.
1040
+ *
1041
+ * \since This function is available since SDL 3.2.0 .
1042
+ *}
1043
+ function SDL_crc32 (crc: cuint32; const data: Pointer; len: csize_t ): cuint32; cdecl;
1044
+ external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name ' _SDL_crc32' {$ENDIF} {$ENDIF};
1045
+
1046
+ {*
1047
+ * Calculate a 32 -bit MurmurHash3 value for a block of data.
1048
+ *
1049
+ * https:// en.wikipedia.org/wiki/MurmurHash
1050
+ *
1051
+ * A seed may be specified, which changes the final results consistently, but
1052
+ * this does not work like SDL_crc16 and SDL_crc32: you can' t feed a previous
1053
+ * result from this function back into itself as the next seed value to
1054
+ * calculate a hash in chunks; it won' t produce the same hash as it would if
1055
+ * the same data was provided in a single call.
1056
+ *
1057
+ * If you aren' t sure what to provide for a seed, zero is fine. Murmur3 is not
1058
+ * cryptographically secure, so it shouldn' t be used for hashing top-secret
1059
+ * data.
1060
+ *
1061
+ * \param data the data to be hashed.
1062
+ * \param len the size of data, in bytes.
1063
+ * \param seed a value that alters the final hash value.
1064
+ * \returns a Murmur3 32 -bit hash value.
1065
+ *
1066
+ * \threadsafety It is safe to call this function from any thread.
1067
+ *
1068
+ * \since This function is available since SDL 3.2.0 .
1069
+ *}
1070
+ function SDL_murmur3_32 (const data: Pointer; len: csize_t ; seed: cuint32): cuint32;
1071
+ external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name ' _SDL_murmur3_32' {$ENDIF} {$ENDIF};
1072
+
1000
1073
(* -- Floating-point arithmetic functions -- *)
1001
1074
1002
1075
{*
0 commit comments