User Tools

Site Tools


prime:bitwise

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
prime:bitwise [2017/12/04 02:24]
webmasterpdx
prime:bitwise [2017/12/04 23:16] (current)
webmasterpdx
Line 8: Line 8:
 EXPORT BITLIB() EXPORT BITLIB()
 BEGIN BEGIN
- 
 END; END;
  
 EXPORT BIT(X,N) // GET NTH BIT OF X EXPORT BIT(X,N) // GET NTH BIT OF X
 BEGIN // LS BIT IS 0 BEGIN // LS BIT IS 0
- ​RETURN ​BITAND(BITSR(X,N),1); + ​RETURN BITSR(X,​N); ​
 END; END;
  
 EXPORT BITSRC(X,N) // BITSR WITH CARRY EXPORT BITSRC(X,N) // BITSR WITH CARRY
 BEGIN // SET C + RETURN SHIFTED BEGIN // SET C + RETURN SHIFTED
- LOCAL r; + ​C:​=BITSR(X,​N-1);​ 
- C:=BITAND(BITSR(X,N-1),1); + RETURN ​BITSR(X,N);
- r:=BITSR(X,N)+
- ​RETURN r;+
 END; END;
  
 EXPORT BITSLC(X,N) // BITSL WITH CARRY EXPORT BITSLC(X,N) // BITSL WITH CARRY
 BEGIN // SET C + RETURN SHIFTED BEGIN // SET C + RETURN SHIFTED
- LOCAL r; + ​C:​=BITSR(BITSL(X,​N-1),​GETBITS(X)-1);​ 
- C:=BITSR(BITAND(BITSL(X,​N-1), + RETURN ​BITSL(X,​N); ​
-   ​BITSL(1,​GETBITS(X)-1)),​GETBITS(X)-1);​ +
- r:=BITSL(X,N)+
- ​RETURN r+
 END; END;
  
prime/bitwise.1512383071.txt.gz · Last modified: 2017/12/04 02:24 by webmasterpdx