-/* $OpenBSD: identcpu.c,v 1.121 2021/11/02 23:30:15 mlarkin Exp $ */
+/* $OpenBSD: identcpu.c,v 1.122 2022/01/20 11:06:57 bluhm Exp $ */
/* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*
ci->ci_pkg_id = apicid >> core_bits;
/* Get rid of the package bits */
- core_mask = (1 << core_bits) - 1;
+ core_mask = (1U << core_bits) - 1;
thread_id = apicid & core_mask;
/* Cut logical thread_id into core id, and smt id in a core */
max_coreid = ((eax >> 26) & 0x3f) + 1;
/* SMT */
smt_bits = mask_width(max_apicid / max_coreid);
- smt_mask = (1 << smt_bits) - 1;
+ smt_mask = (1U << smt_bits) - 1;
/* Core */
core_bits = log2(max_coreid);
- core_mask = (1 << (core_bits + smt_bits)) - 1;
+ core_mask = (1U << (core_bits + smt_bits)) - 1;
core_mask ^= smt_mask;
/* Pkg */
pkg_bits = core_bits + smt_bits;
- pkg_mask = -1 << core_bits;
+ pkg_mask = ~0U << core_bits;
ci->ci_smt_id = apicid & smt_mask;
ci->ci_core_id = (apicid & core_mask) >> smt_bits;
-/* $OpenBSD: kern_descrip.c,v 1.204 2021/10/25 10:24:54 claudio Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.205 2022/01/20 11:06:57 bluhm Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
{
u_int off = fd >> NDENTRYSHIFT;
- if (fdp->fd_lomap[off] & (1 << (fd & NDENTRYMASK)))
+ if (fdp->fd_lomap[off] & (1U << (fd & NDENTRYMASK)))
return 1;
return 0;
{
u_int off = fd >> NDENTRYSHIFT;
- fdp->fd_lomap[off] |= 1 << (fd & NDENTRYMASK);
+ fdp->fd_lomap[off] |= 1U << (fd & NDENTRYMASK);
if (fdp->fd_lomap[off] == ~0)
- fdp->fd_himap[off >> NDENTRYSHIFT] |= 1 << (off & NDENTRYMASK);
+ fdp->fd_himap[off >> NDENTRYSHIFT] |= 1U << (off & NDENTRYMASK);
if (fd > fdp->fd_lastfile)
fdp->fd_lastfile = fd;
fdp->fd_freefile = fd;
if (fdp->fd_lomap[off] == ~0)
- fdp->fd_himap[off >> NDENTRYSHIFT] &= ~(1 << (off & NDENTRYMASK));
- fdp->fd_lomap[off] &= ~(1 << (fd & NDENTRYMASK));
+ fdp->fd_himap[off >> NDENTRYSHIFT] &= ~(1U << (off & NDENTRYMASK));
+ fdp->fd_lomap[off] &= ~(1U << (fd & NDENTRYMASK));
#ifdef DIAGNOSTIC
if (fd > fdp->fd_lastfile)
-/* $OpenBSD: kern_sched.c,v 1.73 2021/09/09 18:41:39 mpi Exp $ */
+/* $OpenBSD: kern_sched.c,v 1.74 2022/01/20 11:06:57 bluhm Exp $ */
/*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
*
p->p_p->ps_pid);
TAILQ_INSERT_TAIL(&spc->spc_qs[queue], p, p_runq);
- spc->spc_whichqs |= (1 << queue);
+ spc->spc_whichqs |= (1U << queue);
cpuset_add(&sched_queued_cpus, p->p_cpu);
if (cpuset_isset(&sched_idle_cpus, p->p_cpu))
TAILQ_REMOVE(&spc->spc_qs[queue], p, p_runq);
if (TAILQ_EMPTY(&spc->spc_qs[queue])) {
- spc->spc_whichqs &= ~(1 << queue);
+ spc->spc_whichqs &= ~(1U << queue);
if (spc->spc_whichqs == 0)
cpuset_del(&sched_queued_cpus, p->p_cpu);
}
cpuset_add(struct cpuset *cs, struct cpu_info *ci)
{
unsigned int num = CPU_INFO_UNIT(ci);
- atomic_setbits_int(&cs->cs_set[num/32], (1 << (num % 32)));
+ atomic_setbits_int(&cs->cs_set[num/32], (1U << (num % 32)));
}
void
cpuset_del(struct cpuset *cs, struct cpu_info *ci)
{
unsigned int num = CPU_INFO_UNIT(ci);
- atomic_clearbits_int(&cs->cs_set[num/32], (1 << (num % 32)));
+ atomic_clearbits_int(&cs->cs_set[num/32], (1U << (num % 32)));
}
int
cpuset_isset(struct cpuset *cs, struct cpu_info *ci)
{
unsigned int num = CPU_INFO_UNIT(ci);
- return (cs->cs_set[num/32] & (1 << (num % 32)));
+ return (cs->cs_set[num/32] & (1U << (num % 32)));
}
void
-/* $OpenBSD: subr_pool.c,v 1.234 2021/06/15 05:24:46 dlg Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.235 2022/01/20 11:06:57 bluhm Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
order = arc4random();
o = 0;
}
- if (ISSET(order, 1 << o++))
+ if (ISSET(order, 1U << o++))
XSIMPLEQ_INSERT_TAIL(&ph->ph_items, pi, pi_list);
else
XSIMPLEQ_INSERT_HEAD(&ph->ph_items, pi, pi_list);
-/* $OpenBSD: rtsock.c,v 1.323 2021/12/16 09:33:56 claudio Exp $ */
+/* $OpenBSD: rtsock.c,v 1.324 2022/01/20 11:06:57 bluhm Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
/* but RTM_DESYNC can't be filtered */
if (rtm->rtm_type != RTM_DESYNC) {
if (rop->rop_msgfilter != 0 &&
- !(rop->rop_msgfilter & (1 << rtm->rtm_type)))
+ !(rop->rop_msgfilter & (1U << rtm->rtm_type)))
goto next;
if (ISSET(rop->rop_flagfilter, rtm->rtm_flags))
goto next;
*/
bzero(rtinfo->rti_info, sizeof(rtinfo->rti_info));
for (i = 0; i < sizeof(rtinfo->rti_addrs) * 8; i++) {
- if ((rtinfo->rti_addrs & (1 << i)) == 0)
+ if ((rtinfo->rti_addrs & (1U << i)) == 0)
continue;
if (i >= RTAX_MAX || cp + sizeof(socklen_t) > cplim)
return (EINVAL);
for (i = 0; i < RTAX_MAX; i++) {
if (rtinfo == NULL || (sa = rtinfo->rti_info[i]) == NULL)
continue;
- rtinfo->rti_addrs |= (1 << i);
+ rtinfo->rti_addrs |= (1U << i);
dlen = ROUNDUP(sa->sa_len);
if (m_copyback(m, len, dlen, sa, M_NOWAIT)) {
m_freem(m);
if ((sa = rtinfo->rti_info[i]) == NULL)
continue;
- rtinfo->rti_addrs |= (1 << i);
+ rtinfo->rti_addrs |= (1U << i);
dlen = ROUNDUP(sa->sa_len);
if (cp) {
bcopy(sa, cp, (size_t)dlen);
-/* $OpenBSD: in_pcb.h,v 1.121 2021/01/25 03:40:46 dlg Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.122 2022/01/20 11:06:57 bluhm Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
/* macros for handling bitmap of ports not to allocate dynamically */
#define DP_MAPBITS (sizeof(u_int32_t) * NBBY)
#define DP_MAPSIZE (howmany(65536, DP_MAPBITS))
-#define DP_SET(m, p) ((m)[(p) / DP_MAPBITS] |= (1 << ((p) % DP_MAPBITS)))
-#define DP_CLR(m, p) ((m)[(p) / DP_MAPBITS] &= ~(1 << ((p) % DP_MAPBITS)))
-#define DP_ISSET(m, p) ((m)[(p) / DP_MAPBITS] & (1 << ((p) % DP_MAPBITS)))
+#define DP_SET(m, p) ((m)[(p) / DP_MAPBITS] |= (1U << ((p) % DP_MAPBITS)))
+#define DP_CLR(m, p) ((m)[(p) / DP_MAPBITS] &= ~(1U << ((p) % DP_MAPBITS)))
+#define DP_ISSET(m, p) ((m)[(p) / DP_MAPBITS] & (1U << ((p) % DP_MAPBITS)))
/* default values for baddynamicports [see ip_init()] */
#define DEFBADDYNAMICPORTS_TCP { \
-/* $OpenBSD: ip_esp.c,v 1.193 2021/12/23 22:35:11 bluhm Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.194 2022/01/20 11:06:57 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
wl = tl - window + 1;
idx = (seq % TDB_REPLAYMAX) / 32;
- packet = 1 << (31 - (seq & 31));
+ packet = 1U << (31 - (seq & 31));
/*
* We keep the high part intact when: