← Back to team overview

maria-developers team mailing list archive

Re: 3617add6975: MDEV-27208: Extend CRC32() and implement CRC32C()

 

Hi, Sergei!

On Mon, Jan 3, 2022 at 10:13 PM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> 1. one class for both CRC functions, like
>
>   class Item_func_crc32 :public Item_long_func
>   {
>     extern "C" unsigned (*crc_func)(unsigned int, const char *, size_t);

Done:

  uint32 (*const crc_func)(uint32, const void*, size_t);

My compiler did not accept extern "C" inside a class definition.

The declaration and generic definition of my_checksum were
inconsistent with each other. I fixed the definition to match the
declaration (and the my_crc32c declaration), to be on the safe side.

> 2. swap the arguments:
>
>    CRC32(CRC32("Maria"), "DB") = CRC32("MariaDB")

Done. I also added tests to cover type conversions that take place on
argument type mismatch: CRC32C('5','')=5.

Please find the revised change at
https://github.com/MariaDB/server/commit/d30d31659903f45861afc2d7f966ab0580ab0192
-- 
Marko Mäkelä, Lead Developer InnoDB
MariaDB Corporation


References