store.c

来自「minix操作系统最新版本(3.1.1)的源代码」· C语言 代码 · 共 44 行

C
44
字号
/*  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.  See the copyright notice in the ACK home directory, in the file "Copyright".*//*  Module:	store values from stack, byte by byte  Author:	Ceriel J.H. Jacobs  Version:	$Header: /cvsup/minix/src/lib/ack/libm2/store.c,v 1.1 2005/10/10 15:27:46 beng Exp $*/#include <m2_traps.h>#ifndef EM_WSIZE#define EM_WSIZE _EM_WSIZE#define EM_PSIZE _EM_PSIZE#endif#if EM_WSIZE==EM_PSIZEtypedef unsigned pcnt;#elsetypedef long pcnt;#endifstore(siz, addr, p)	register char *addr;	register pcnt siz;{	/*	Make sure, that a value with a size that could have been		handled by the LOI instruction is handled as if it was		loaded with the LOI instruction.	*/	register char *q = (char *) &p;	char t[4];	if (siz < EM_WSIZE && EM_WSIZE % siz == 0) {		/* as long as EM_WSIZE <= 4 ... */		if (siz != 2) TRP(M2_INTERNAL);	/* internal error */		*((unsigned short *) (&t[0])) = *((unsigned *) q);		q = &t[0];	}	while (siz--) *addr++ = *q++;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?