Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/cmd/aquarela/smbconv.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "headers.h"

ushort
smbnhgets(uchar *p)
{
	return p[0] | (p[1] << 8);
}

ulong
smbnhgetl(uchar *p)
{
	return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}

void
smbhnputs(uchar *p, ushort v)
{
	p[0] = v;
	p[1] = v >> 8;
}

void
smbhnputl(uchar *p, ulong v)
{
	p[0] = v;
	p[1] = v >> 8;
	p[2] = v >> 16;
	p[3] = v >> 24;
}

void
smbhnputv(uchar *p, vlong v)
{
	smbhnputl(p, v);
	smbhnputl(p + 4, (v >> 32) & 0xffffffff);
}

vlong
smbnhgetv(uchar *p)
{
	return (vlong)smbnhgetl(p) | ((vlong)smbnhgetl(p + 4) << 32);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].