strlen.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 40 行

C
40
字号
#ifndef lintstatic char *sccsid = "@(#)strlen.c	4.1	(ULTRIX)	7/3/90";#endif not lint/* ------------------------------------------------------------------ *//* | Copyright Unpublished, MIPS Computer Systems, Inc.  All Rights | *//* | Reserved.  This software contains proprietary and confidential | *//* | information of MIPS and its suppliers.  Use, disclosure or     | *//* | reproduction is prohibited without the prior express written   | *//* | consent of MIPS.                                               | *//* ------------------------------------------------------------------ *//* $Header: strlen.c,v 1.1 87/02/16 11:17:42 dce Exp $ *//* * Returns the number of non-NULL bytes in string argument. * Original code: *	strlen(s) *	register char *s; *	{ *		register n; *		n = 0; *		while (*s++) *			n++; *		return(n); *	} *//* Code optimized for mips.  4 cycles/byte. */strlen(s)register char *s;{	register char *p = s + 1;	register unsigned c;	/* c exists only because UOPT wastes a				   register (but no cycles) if the				   while is written as *s++ != '\0' */	do {		c = *s++;	} while (c != '\0');	return s - p;}

⌨️ 快捷键说明

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