lkml.org 
[lkml]   [2023]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/2] tracing/hist: add modulus operator
On Thu,  2 Mar 2023 17:17:55 +0000
Mark Rutland <mark.rutland@arm.com> wrote:

> @@ -436,6 +438,21 @@ static u64 hist_field_mult(struct hist_field *hist_field,
> return val1 * val2;
> }
>
> +static u64 hist_field_mod(struct hist_field *hist_field,
> + struct tracing_map_elt *elt,
> + struct trace_buffer *buffer,
> + struct ring_buffer_event *rbe,
> + void *event)
> +{
> + struct hist_field *operand1 = hist_field->operands[0];
> + struct hist_field *operand2 = hist_field->operands[1];
> +
> + u64 val1 = hist_fn_call(operand1, elt, buffer, rbe, event);
> + u64 val2 = hist_fn_call(operand2, elt, buffer, rbe, event);
> +
> + return val1 % val2;

Is modulus operations on 64 bit integers valid on 32 bit architectures?

Don't we need to do something like:

div64_u64_rem(val1, val2, &rem);
return rem;

?

-- Steve

> +}
> +

\
 
 \ /
  Last update: 2023-03-27 01:06    [W:0.046 / U:1.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site