![]() RTN Do nothing if X was >= WSIZE XEQ 67 Y≥WSIZE? RTN X must have been >= 0 & Y RTN (SETB) DSC: Set the Xth bit of Y IN: Y: An integer X: An integer (0=LSB) OUT: X: Integer with IP(X)th bit of Y set FAQ: Y is returned unchanged when X is out of range BUG: When X out of range, the type Y is not error checked UPD: LBL "SETB" FUNC 21 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 IP XY Do nothing if X was negative 0>? ST Y NOT All ones case? XEQ 67 Y≥WSIZE? RTN R↓ Some ones case ROTXY XY NUM_N MASK CNT GTO 70 LBL 72 No bits left to check R↓ MASK CNT R↓ CNT RTN (MSKn) DSC: Create integer with Y set bits located at bit X IN: Y: An integer IN: X: An integer (LSB=0) OUT: X: Integer with IP(X) least significant bits set FAQ: Returns int with all 0 bits when X=WSIZE? UPD: LBL "MSKn" FUNC 21 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 XY XEQ "MSKR" XY XEQ "SLn" RTN (MSKL) DSC: Create integer with left most X bits set IN: X: An integer OUT: X: Integer with IP(X) most significant bits set FAQ: Returns int with all 0 bits when X=WSIZE? UPD: LBL "MSKL" FUNC 11 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 XEQ "MSKR" XEQ "LJ" R↓ RTN (MSKR) DSC: Create integer with right most X bits set IN: X: An integer OUT: X: Integer with IP(X) least significant bits set FAQ: Returns int with all 0 bits when X=WSIZE? UPD: LBL "MSKR" FUNC 11 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 IP All zeros case? STO+ ST T 1 NUM_N MASK CNT LBL 71 Current bit was clear R↓ NUM_N MASK CNT X=0? GTO 72 Still have bits to check XY MASK NUM_N CNT NOT XY NUM MASK CNT LBL 70 RCL ST Y MASK NUM MASK CNT XY NUM MASK MASK CNT AND NUM_N MASK CNT LASTX NUM NUM_N MASK CNT X=Y? GTO 71 Current bit was set: increment counter R↓ NUM_N MASK CNT ![]() Toggle BVIEW padding (Flag (ref:b#) DSC: Number of bits set IN: X: an integer OUT: X: Number of 1 bits in IP(X) FAQ: Runtime complexity O(log_2(X)) LBL: Used 70-72 UPD: LBL "B#" LBL "B#" FUNC 11 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 IP ![]() Position of the Least Significant Set BitĬreate integer with right most X bits setĬreate integer with Y set bits located at bit X Assign X to the Yth bit of the Y bits of Z starting at bit Y bits of Z starting at bit Y bits of Z starting at bit LS Z bits of X to Z bits of T starting at Y ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |