问题
Need it for a program I'm writing (repeated squaring to comput x^n). I can't seem to find the syntax for it, or if it is even supported.
回答1:
They're available within the Word8 and Word structures.
let
open Word8
infix andb orb xorb notb << >> ~>>
in
print (Word8.fmt StringCvt.BIN 0wxF) (* 1111 *)
; print "\n"
; print (Word8.fmt StringCvt.BIN 0wxA) (* 1010 *)
; print "\n"
; print (Word8.fmt StringCvt.BIN (0wxF andb 0wxA)) (* 1010 *)
; print "\n"
end
来源:https://stackoverflow.com/questions/35742341/how-to-do-bitwise-and-in-sml-nj