Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gf128_add can be marked as __pure2

0 views
Skip to first unread message

Eitan Adler

unread,
Feb 19, 2018, 10:19:45 PM2/19/18
to
Is there any reason not to apply this patch?

__pure2 means __attribute__((const)) which is correct in this case as
gf128_add read no global memory:


Index: gfmult.h
===================================================================
--- gfmult.h (revision 329611)
+++ gfmult.h (working copy)
@@ -108,7 +108,7 @@ gf128_write(struct gf128 v, uint8_t *buf)
be64enc(buf, v.v[1]);
}

-static inline struct gf128 __pure /* XXX - __pure2 instead */
+static inline struct gf128 __pure2
gf128_add(struct gf128 a, struct gf128 b)
{
a.v[0] ^= b.v[0];


--
Eitan Adler
_______________________________________________
freebsd...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hacke...@freebsd.org"

John-Mark Gurney

unread,
Mar 17, 2018, 1:49:55 PM3/17/18
to
Eitan Adler wrote this message on Mon, Feb 19, 2018 at 19:15 -0800:
> Is there any reason not to apply this patch?

I don't see why there wouldn't be..

> __pure2 means __attribute__((const)) which is correct in this case as
> gf128_add read no global memory:

Are these documented some where? Looksl ike __pure2 was created instead
of using __pure for some reason... I wish these things were documented
properly so others could know the correct usage...

> Index: gfmult.h
> ===================================================================
> --- gfmult.h (revision 329611)
> +++ gfmult.h (working copy)
> @@ -108,7 +108,7 @@ gf128_write(struct gf128 v, uint8_t *buf)
> be64enc(buf, v.v[1]);
> }
>
> -static inline struct gf128 __pure /* XXX - __pure2 instead */
> +static inline struct gf128 __pure2
> gf128_add(struct gf128 a, struct gf128 b)
> {
> a.v[0] ^= b.v[0];

--
John-Mark Gurney Voice: +1 415 225 5579

"All that I will do, has been done, All that I have, has not."

Eitan Adler

unread,
Mar 17, 2018, 2:42:33 PM3/17/18
to
On 17 March 2018 at 10:38, John-Mark Gurney <j...@funkthat.com> wrote:
> Eitan Adler wrote this message on Mon, Feb 19, 2018 at 19:15 -0800:
>> Is there any reason not to apply this patch?
>
> I don't see why there wouldn't be..
>
>> __pure2 means __attribute__((const)) which is correct in this case as
>> gf128_add read no global memory:
>
> Are these documented some where? Looksl ike __pure2 was created instead
> of using __pure for some reason... I wish these things were documented
> properly so others could know the correct usage...

I don't know where the FreeBSD macros are documented (they are
implementedi cdefs.h).
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
documents the attributes

__pure2 is const
__pure is pure

--
Eitan Adler

Eitan Adler

unread,
Jun 13, 2018, 6:33:24 AM6/13/18
to
On 17 March 2018 at 11:38, Eitan Adler <li...@eitanadler.com> wrote:
> On 17 March 2018 at 10:38, John-Mark Gurney <j...@funkthat.com> wrote:
>> Eitan Adler wrote this message on Mon, Feb 19, 2018 at 19:15 -0800:
>>> Is there any reason not to apply this patch?
>>
>> I don't see why there wouldn't be..
>>
>>> __pure2 means __attribute__((const)) which is correct in this case as
>>> gf128_add read no global memory:

For extra clarity, since this is crypto related, can you please accept
here: https://reviews.freebsd.org/D15786
0 new messages