All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ihor Solodrai" <ihor.solodrai@linux.dev>
To: "Andrii Nakryiko" <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, andrii@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, eddyz87@gmail.com, mykolal@fb.com,
	kernel-team@meta.com
Subject: Re: [PATCH bpf-next 1/2] libbpf: implement bpf_usdt_arg_size BPF function
Date: Mon, 24 Feb 2025 23:14:59 +0000	[thread overview]
Message-ID: <6b35b7490955800b5cc3833508c88914d59d0d85@linux.dev> (raw)
In-Reply-To: <CAEf4Bzb4T3DcySAyyCXWBK-ShyW9iuE-OM9f7EHXmBJg5Qm0eg@mail.gmail.com>

On 2/24/25 2:05 PM, Andrii Nakryiko wrote:

> [...]
>
> arg_bitshift is stored as char (which could be signed), so that's why
> you were getting signed division, just cast to unsigned and keep
> division:
>
> return (64 - (unsigned)arg_spec->arg_bitshift) / 8;

As it turns out, this doesn't work either. Presumably because
(64 - (u8)x) is still a signed int.

This works, however:

    return (unsigned char)(64 - arg_spec->arg_bitshift) / 8;

>
>> [...]

  parent reply	other threads:[~2025-02-24 23:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 21:59 [PATCH bpf-next 1/2] libbpf: implement bpf_usdt_arg_size BPF function Ihor Solodrai
2025-02-20 21:59 ` [PATCH bpf-next 2/2] selftests/bpf: test bpf_usdt_arg_size() function Ihor Solodrai
2025-02-24 22:05 ` [PATCH bpf-next 1/2] libbpf: implement bpf_usdt_arg_size BPF function Andrii Nakryiko
2025-02-24 22:21   ` Ihor Solodrai
2025-02-24 23:14   ` Ihor Solodrai [this message]
2025-02-24 23:25     ` Andrii Nakryiko
2025-02-24 23:38       ` Ihor Solodrai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b35b7490955800b5cc3833508c88914d59d0d85@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=mykolal@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.