From patchwork Thu Sep 15 18:26:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 37935 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp489008pzh; Thu, 15 Sep 2022 11:26:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77Q2O/QgRztnvmZRIUC9zLDg3/FPKruhIZW/UdrAhudcIXW6PJJWmfpA0UChaAqiyY3pK0 X-Received: by 2002:a17:907:74e:b0:74f:83d4:cf58 with SMTP id xc14-20020a170907074e00b0074f83d4cf58mr883698ejb.178.1663266419530; Thu, 15 Sep 2022 11:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663266419; cv=none; d=google.com; s=arc-20160816; b=L3ypID14J9CUTLJyPdXOo78OKwiWabNl29Hz7TqeDg1OX3D9ug2JNo9WyFQmD6/Wqi if18+T7p4UZbtldm0PKXvAmCZo9DsKjxKaPQDy6cAHScFVEGFG31ZY8fmbuQkl8svYas Dm6xobVnY0A1JZdooW3KGriE/3Dzw3Lj7YoJMmEmMOIx9jzlbxalbOdKa5xS003Tc10r FWIGlgE+RHT9usBy1rmH/P0G7rWq2HwCq1kwE6koq0Sa7wt9n2qZbVSSkWjvjuE/mQTE 0EDuXli6shfdV3QXWaDKuC3x/KEONmkpsKGPbMAARZZhTWx3dxfijpm8zeQzk+usyzIn 8NMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=tjier6pw2ntFxaMNlvlXyxf2EONGn3Sn2FEAHLoFhtY=; b=r3XddXTc9rUtjUTLEU3z7DffYI9lUK+NYKNy48pdKa3pIiM2xLj8QGuGEJ5YWnd4Wk 6etCaGepN8MnRGDgOEca1whLiADhODgK1KefmOBzbLpFpNnhVjPtU/l+7a4nM5oC1djI y84pLW2O37bpkkBlnBxZsZq2XtJh/i0qNp0Ojw0GKbncVYNiW2729UmiZtSiwXKTOwOr Am1H89WrbN3XtHtHKujf/oUcaGUIHf+5dAXiCLbyRc5VyrfM/60Ji3XyvmgYPCIcrCEU 2VnQS3SFHqVxYG4/OlBKtZVANIJme55tB6F7qPjEehfuuGXu2TeW/jsnWhiUUJSNWZV0 RYjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t21-20020a056402525500b00450bda7e3fdsi117302edd.28.2022.09.15.11.26.58; Thu, 15 Sep 2022 11:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B922E68BBB0; Thu, 15 Sep 2022 21:26:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7231A68BBB0 for ; Thu, 15 Sep 2022 21:26:49 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id AEDD8C0001 for ; Thu, 15 Sep 2022 21:26:48 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:26:48 +0300 Message-Id: <20220915182648.30369-1-remi@remlab.net> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/riscv: fix off-by-one in bit-magnitude clip X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VAB3sbAcMcRw From: RĂ©mi Denis-Courmont --- libavutil/riscv/intmath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/riscv/intmath.h b/libavutil/riscv/intmath.h index 3263a79dc4..45bce9a0e7 100644 --- a/libavutil/riscv/intmath.h +++ b/libavutil/riscv/intmath.h @@ -61,8 +61,8 @@ static av_always_inline av_const int32_t av_clipl_int32_rvi(int64_t a) #define av_clip_intp2 av_clip_intp2_rvi static av_always_inline av_const int av_clip_intp2_rvi(int a, int p) { - const int shift = 32 - p; - int b = (a << shift) >> shift; + const int shift = 31 - p; + int b = ((int)(((unsigned)a) << shift)) >> shift; if (a != b) b = (a >> 31) ^ ((1 << p) - 1);