LIB$FFS         - find first set bit                             21-AUG-1978 18:57:43   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)     100  DECLARATIONS

   (3)     100  LIB$FFS  - find first set bit 

LIB$FFS         - find first set bit                             21-AUG-1978 18:57:43   VAX-11 MACRO X0.3-11               Page   1

00-03                                                                                                                            (1)



                                     0000   100 	.TITLE	LIB$FFS - find first set bit 

                                     0000   200 	.IDENT	/00-03/			; File: LIBFFS.MAR

                                     0000   300 

                                     0000   400 ;

                                     0000   500 ;			  COPYRIGHT (c) 1977 BY

                                     0000   600 ;	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

                                     0000   700 ;

                                     0000   800 ; THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED

                                     0000   900 ; ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE

                                     0000  1000 ; INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER

                                     0000  1100 ; COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY

                                     0000  1200 ; OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY

                                     0000  1300 ; TRANSFERRED.

                                     0000  1400 ;

                                     0000  1500 ; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE

                                     0000  1600 ; AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT

                                     0000  1700 ; CORPORATION.

                                     0000  1800 ;

                                     0000  1900 ; DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS

                                     0000  2000 ; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

                                     0000  2100 ;

                                     0000  2200 

                                     0000  2300 ;++

                                     0000  2400 ; FACILITY: General Utility Library

                                     0000  2500 ;

                                     0000  2600 ; ABSTRACT:

                                     0000  2700 ;

                                     0000  2800 ;	A bit string is scanned for the first bit set.  If one is found before

                                     0000  2900 ;	the string is exhausted then a success status is returned.  Otherwise a

                                     0000  3000 ;	failure status is returned.

                                     0000  3100 ;

                                     0000  3200 ; ENVIRONMENT: User Mode, AST Reentrant

                                     0000  3300 ;

                                     0000  3400 ;--

                                     0000  3500 ; AUTHOR: Donald G. Petersen, CREATION DATE: 03-Jan-78

                                     0000  3600 ;

                                     0000  3700 ; MODIFIED BY:

                                     0000  3800 ;

                                     0000  3900 ;	DGP, 03-Jan-78 : VERSION 00

                                     0000  4000 ; 01	- Original 

                                     0000  4100 ; 00-02	- DGP 06-Jan-78 - change LIB$NOTFOU to literal

                                     0000  4200 ;			  change BEQL to BNEQ following FFS

                                     0000  4300 ; 00-03	- Return SS$_NORMAL instead of SS$_NORMAL.  TNH 15-July-78

LIB$FFS         - find first set bit                             21-AUG-1978 18:57:43   VAX-11 MACRO X0.3-11               Page   2

00-03           DECLARATIONS                                                                                                     (2)



                                     0000   100 	.SBTTL	DECLARATIONS

                                     0000   200 ;

                                     0000   300 ; INCLUDE FILES:

                                     0000   400 ;

                                     0000   500 

                                     0000   600 ;

                                     0000   700 ; EXTERNAL DECLARATIONS:

                                     0000   800 ;

                                     0000   900 	.DSABL	GBL				; Disable automatic generation of

                                     0000  1000 						; .EXTRN

                                     0000  1100 	.EXTRN	SS$_NORMAL			; Normal successful completion

                                     0000  1200 	.EXTRN	LIB$_NOTFOU			; SEVERE error condition 

                                     0000  1300 						; Value not found

                                     0000  1400 

                                     0000  1500 ;

                                     0000  1600 ; MACROS:

                                     0000  1700 ;

                                     0000  1800 

                                     0000  1900 ;

                                     0000  2000 ; EQUATED SYMBOLS:

                                     0000  2100 ;

                                     0000  2200 

                                     0000  2300 ;

                                     0000  2400 ; OWN STORAGE:

                                     0000  2500 ;

                                     0000  2600 

                                     0000  2700 ;

                                     0000  2800 ; PSECT DECLARATIONS:

                                     0000  2900 ;

                                 00000000  3000 	.PSECT LIB$CODE PIC, SHR, LONG, EXE, NOWRT

                                     0000  3100 

LIB$FFS         - find first set bit                             21-AUG-1978 18:57:43   VAX-11 MACRO X0.3-11               Page   3

00-03           LIB$FFS  - find first set bit                                                                                    (3)



                                     0000   100 	.SBTTL	LIB$FFS  - find first set bit 

                                     0000   200 ;++

                                     0000   300 ; FUNCTIONAL DESCRIPTION:

                                     0000   400 ;

                                     0000   500 ;	The field specified by the start position, size, and base is searched

                                     0000   600 ;	for the first set bit.  If one is found, a success status is returned as

                                     0000   700 ;	well as the bit position (relative to the base) in the find position.

                                     0000   800 ;	If a set bit is not found, a failure status is returned.  If the size specified

                                     0000   900 ;	is zero then a failure status is returned.

                                     0000  1000 ;

                                     0000  1100 ; CALLING SEQUENCE:

                                     0000  1200 ;

                                     0000  1300 ;	status.wlc.v = LIB$FFS (startpos.rl.r, size.rbu.r, base.rl.r, findpos.wl.r)

                                     0000  1400 ;

                           00000004  0000  1500 	STARTPOS = 4				; Adr of start position

                           00000008  0000  1600 	SIZE = 8				; Adr of size

                           0000000C  0000  1700 	BASE = 12				; Adr of base

                           00000010  0000  1800 	FINDPOS = 16				; Adr of field for set bit position

                                     0000  1900 

                                     0000  2000 ; INPUT PARAMETERS:

                                     0000  2100 ;

                                     0000  2200 ;	NONE

                                     0000  2300 ;

                                     0000  2400 ; IMPLICIT INPUTS:

                                     0000  2500 ;

                                     0000  2600 ;	NONE

                                     0000  2700 ;

                                     0000  2800 ; OUTPUT PARAMETERS:

                                     0000  2900 ;

                                     0000  3000 ;	NONE

                                     0000  3100 ;

                                     0000  3200 ; IMPLICIT OUTPUTS:

                                     0000  3300 ;

                                     0000  3400 ;	NONE

                                     0000  3500 ;

                                     0000  3600 ; FUNCTION VALUE:

                                     0000  3700 ;

                                     0000  3800 ;	SS$_NORMAL - if a set bit is found

                                     0000  3900 ;	LIB$_NOTFOU - if a set bit is not found

                                     0000  4000 ;

                                     0000  4100 ; SIDE EFFECTS:

                                     0000  4200 ;

                                     0000  4300 ;	SS$_ROPRAND - reserved operand fault occurs if:

                                     0000  4400 ;		    1.) size greater than 32 is specified

                                     0000  4500 ;		    2.) start position is greater than 31 and field is in registers 

                                     0000  4600 ;

                                     0000  4700 ;--

                                     0000  4800 

                               0000' 0000  4900 	.ENTRY LIB$FFS , ^M< >		; Entry point

                                     0002  5000 

         08 BC         04 BC     EA  0002  5100 	FFS	@STARTPOS(AP), @SIZE(AP), -	; find first set bit

         10 BC         0C BC         0007       

                                     000B  5200 		@BASE(AP), @FINDPOS(AP)

                          08     12  000B  5300 	BNEQ	10$				; branch if bit found

            50   00000000'8F     D0  000D  5400 	MOVL	#LIB$_NOTFOU, R0		; return failure status

                                 04  0014  5500 	RET

            50   00000000'8F     D0  0015  5600 10$:	MOVL	#SS$_NORMAL, R0		; return success status

LIB$FFS         - find first set bit                             21-AUG-1978 18:57:43   VAX-11 MACRO X0.3-11               Page   4

00-03           LIB$FFS  - find first set bit                                                                                    (3)



                                 04  001C  5700 	RET

                                     001D  5800 	.END

LIB$FFS         - find first set bit                             21-AUG-1978 18:57:43   VAX-11 MACRO X0.3-11               Page   5

SYMBOL TABLE                                                                                                                     (3)



BASE           = 0000000C            

FINDPOS        = 00000010            

FOR$K_ERR_PREFX= 00000018            

LIB$FFS          00000000 RG    02   

LIB$_NOTFOU      ********   X   01   

MTH$K_ERR_PREFX= 00000016            

MTH__FLOOVEMAT = 00000058            

MTH__FLOUNDMAT = 00000059            

MTH__INVARG    = 00000051            

MTH__LOGZERNEG = 00000053            

MTH__SINSIGLOS = 00000057            

MTH__SQUROONEG = 00000054            

MTH__UNDEXP    = 00000052            

MTH__WRONUMARG = 00000050            

SIZE           = 00000008            

SS$_NORMAL       ********   X   01   

STARTPOS       = 00000004            





PROGRAM SECTION SYNOPSIS



.  ABS  .        00000000      00     NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT BYTE  

. BLANK .        00000000      01     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT BYTE  

LIB$CODE         0000001D      02       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

27944. BYTES LEFT IN FREE MEMORY POOL.

OBJ$:LIBFFS,LIS$:LIBFFS/-SP=LIB$:S/ML,SRC$:P,LIBFFS

0 MLB DIR RDS - 0 GETS TO DEFINE 0 MACROS. 2 INTER. FILE WRITES. 

