xref: /kernel/linux/linux-5.10/arch/sh/lib/lshrdi3.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/arch/sh/lib/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#include <linux/module.h>
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include "libgcc.h"
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_cilong long __lshrdi3(long long u, word_type b)
78c2ecf20Sopenharmony_ci{
88c2ecf20Sopenharmony_ci	DWunion uu, w;
98c2ecf20Sopenharmony_ci	word_type bm;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci	if (b == 0)
128c2ecf20Sopenharmony_ci		return u;
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci	uu.ll = u;
158c2ecf20Sopenharmony_ci	bm = 32 - b;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	if (bm <= 0) {
188c2ecf20Sopenharmony_ci		w.s.high = 0;
198c2ecf20Sopenharmony_ci		w.s.low = (unsigned int) uu.s.high >> -bm;
208c2ecf20Sopenharmony_ci	} else {
218c2ecf20Sopenharmony_ci		const unsigned int carries = (unsigned int) uu.s.high << bm;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci		w.s.high = (unsigned int) uu.s.high >> b;
248c2ecf20Sopenharmony_ci		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
258c2ecf20Sopenharmony_ci	}
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	return w.ll;
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__lshrdi3);
31

Indexes created Thu Nov 07 10:32:03 CST 2024