xref: /kernel/linux/linux-5.10/arch/sh/lib/ashrdi3.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 __ashrdi3(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 = 1..1 or 0..0 */
198c2ecf20Sopenharmony_ci		w.s.high =
208c2ecf20Sopenharmony_ci		    uu.s.high >> 31;
218c2ecf20Sopenharmony_ci		w.s.low = uu.s.high >> -bm;
228c2ecf20Sopenharmony_ci	} else {
238c2ecf20Sopenharmony_ci		const unsigned int carries = (unsigned int) uu.s.high << bm;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci		w.s.high = uu.s.high >> b;
268c2ecf20Sopenharmony_ci		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
278c2ecf20Sopenharmony_ci	}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	return w.ll;
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__ashrdi3);
33

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