⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rxvtlib_rmemset.c

📁 具有IDE功能的编辑器
💻 C
字号:
#include "rxvtlib.h"/*---------------------------------------------------------------------------* * File:	rmemset.c *---------------------------------------------------------------------------* * $Id: rmemset.c,v 1.17 1999/05/05 09:31:49 mason Exp $ * * Copyright (C) 1997,1998 Geoff Wing <gcw@pobox.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *--------------------------------------------------------------------------*//*--------------------------------------------------------------------------* * Fast memset() * presumptions: *   1) intp_t write the best *   2) SIZEOF_INT_P= power of 2 *--------------------------------------------------------------------------*/#ifndef NO_RMEMSET/* EXTPROTO */void            rmemset (void *p, unsigned char c, intp_t len){    u_intp_t        i, val, *rp;    unsigned char  *lp;    if (len < 16)		/* probably not worth all the calculations */	lp = p;    else {/* write out preceding characters so we align on an integer boundary */	if ((i = ((-(u_intp_t) p) & (SIZEOF_INT_P - 1))) == 0)	    rp = p;	else {	    len -= i;	    for (lp = p; i--;)		*lp++ = c;	    rp = (u_intp_t *) lp;	}/* do the fast writing */	val = (c << 8) + c;#if SIZEOF_INT_P >= 4	val |= (val << 16);#endif#if SIZEOF_INT_P >= 8	val |= (val << 32);#endif#if SIZEOF_INT_P == 16	val |= (val << 64);#endif	for (i = len / SIZEOF_INT_P; i--;)	    *rp++ = val;	len &= (SIZEOF_INT_P - 1);	lp = (unsigned char *)rp;    }/* write trailing characters */    for (; len--;)	*lp++ = c;}#endif

⌨️ 快捷键说明

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