Files
bind9/lib/dns
Ondřej Surý 03ed19cf71 Refactor the common buffer manipulation in rdataslab.c in macros
The rdataslab.c was full of code like this:

        length = raw[0] * 256 + raw[1];

and

        count2 = *current2++ * 256;
        count2 += *current2++;

Refactor code like this into peek_uint16() and get_uint16 macros
to prevent code repetition and possible mistakes when copy and
pasting the same code over and over.

As a side note for an entertainment of a careful reader of the commit
messages: The byte manipulation was changed from multiplication and
addition to shift with or.

The difference in the assembly looks like this:

MUL and ADD:

	movzx   eax, BYTE PTR [rdi]
        movzx   edi, BYTE PTR [rdi+1]
        sal     eax, 8
        or      edi, eax

SHIFT and OR:

        movzx   edi, WORD PTR [rdi]
        rol     di, 8
        movzx   edi, di

If the result and/or buffer is then being used after the macro call,
there's more differences in favor of the SHIFT+OR solution.
2024-05-24 09:52:45 +02:00
..
2024-05-17 16:03:21 -07:00
2023-10-13 14:44:40 +02:00
2024-03-08 15:36:56 -08:00
2024-02-14 13:24:56 +01:00
2024-03-08 15:36:56 -08:00
2024-01-25 15:37:40 +01:00
2024-02-14 13:24:56 +01:00
2024-02-08 08:01:58 +01:00
2024-03-08 15:36:56 -08:00
2024-05-07 10:01:12 +10:00
2024-04-30 12:50:01 -07:00
2024-04-02 10:35:56 +02:00
2024-05-16 09:49:41 +00:00
2024-03-08 15:36:56 -08:00
2024-03-06 09:57:24 +01:00
2024-04-10 22:51:07 -04:00
2024-04-23 13:11:52 +02:00
2024-04-10 22:51:07 -04:00
2023-10-13 14:44:40 +02:00
2023-11-21 14:48:43 +11:00
2024-01-05 11:16:12 +01:00
2024-01-25 14:48:07 +01:00
2024-04-30 12:50:01 -07:00