Linux Audio

Check our new training course

Embedded Linux training

Mar 31-Apr 8, 2025
Register
Loading...
v3.1
 1#include <linux/module.h>
 
 2
 3#include "libgcc.h"
 4
 5long long __ashrdi3(long long u, word_type b)
 6{
 7	DWunion uu, w;
 8	word_type bm;
 9
10	if (b == 0)
11		return u;
12
13	uu.ll = u;
14	bm = 32 - b;
15
16	if (bm <= 0) {
17		/* w.s.high = 1..1 or 0..0 */
18		w.s.high =
19		    uu.s.high >> 31;
20		w.s.low = uu.s.high >> -bm;
21	} else {
22		const unsigned int carries = (unsigned int) uu.s.high << bm;
23
24		w.s.high = uu.s.high >> b;
25		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
26	}
27
28	return w.ll;
29}
30
31EXPORT_SYMBOL(__ashrdi3);
v4.17
 1// SPDX-License-Identifier: GPL-2.0
 2#include <linux/export.h>
 3
 4#include "libgcc.h"
 5
 6long long notrace __ashrdi3(long long u, word_type b)
 7{
 8	DWunion uu, w;
 9	word_type bm;
10
11	if (b == 0)
12		return u;
13
14	uu.ll = u;
15	bm = 32 - b;
16
17	if (bm <= 0) {
18		/* w.s.high = 1..1 or 0..0 */
19		w.s.high =
20		    uu.s.high >> 31;
21		w.s.low = uu.s.high >> -bm;
22	} else {
23		const unsigned int carries = (unsigned int) uu.s.high << bm;
24
25		w.s.high = uu.s.high >> b;
26		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
27	}
28
29	return w.ll;
30}
31
32EXPORT_SYMBOL(__ashrdi3);