| [ QuizWit ] in KIDS 글 쓴 이(By): Sue (eXponent) 날 짜 (Date): 2002년 6월 14일 금요일 오후 02시 05분 49초 제 목(Title): Re: 0 과 1을 토글하는 방법 에 대한 리뷰. >0 과 1 을 토글하는 방법에 대해 이야기 나오다 보니,, >이런 여러가지 방법이 나오는군요.. >int nflip = 0; >if( nflip == 0 ) nflip = 1; else nflip = 0; movlw 0x00 movwf nfilp, f movlw 0x00 cpfseq nflip goto truecase goto falsecase truecase movlw 0x00 movwf nflip goto next falsecase movlw 0x01 movwf nflip goto next next >nflip = nflip ? 0 : 1; tstfsz nflip goto truecase goto falsecase truecase movlw 0x00 movwf nflip goto next falsecase movlw 0x01 movwf nflip goto next next >nflip = ( nflip + 1 ) % 2; ????????? >nflip = ( nflip + 1 ) & 1; incf nflip, w andlw 0x01 movwf nflip >nflip = 1 - nflip; movfp nflip, wreg sublw 0x01 movwf nflip >nflip ^= 1; movlw 0x01 xorwf nflip, f >nflip = !nflip; // 이게 되나?? ????????? comf nflip, w andlw 0x01 movwf nflip >.. >아래쪽으로 갈수록 더 빠를거 같네요.. btg nflip, 0 ----------------------------------------------- "nflip = !nflip;"가 제일 빠르지는 않을 것 같다는.. |