【问题标题】:How to do bitwise AND in SML/NJ?如何在 SML/NJ 中进行按位与?
【发布时间】:2016-06-15 00:25:47
【问题描述】:

我正在编写的程序需要它(重复平方以计算 x^n)。我似乎找不到它的语法,或者它是否受支持。

【问题讨论】:

  • 我想我在这里的回答已经回答了你的other question,所以要么删除那个,要么编辑它,如果那里有你想要的其他东西。

标签: binary sml smlnj


【解决方案1】:

它们在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

【讨论】:

  • 我要注意IntInf结构中还有andb orb xorb notb &lt;&lt; ~&gt;&gt;(虽然不是&gt;&gt;
  • 链接坏了; here's the updated link
猜你喜欢
  • 1970-01-01
  • 2010-09-16
  • 2010-10-23
  • 2011-11-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-19
  • 2012-01-04
相关资源
最近更新 更多