* [Caml-list] Bitwise negation operator?
@ 2003-02-21 23:12 Brian Hurt
2003-02-21 23:16 ` Emmanuel Renieris
0 siblings, 1 reply; 2+ messages in thread
From: Brian Hurt @ 2003-02-21 23:12 UTC (permalink / raw)
To: Ocaml Mailing List
Is there a bitwise negation operator I'm just missing? I'm looking for
the equivelent of C's ~ operator. In Ocaml, it would have type int->int.
In two's complement, I can implement this as either
let lneg x = (-x) - 1
or:
let lneg x = x lxor -1
I dislike depending upon being two's complement for bitwise negation.
Brian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Bitwise negation operator?
2003-02-21 23:12 [Caml-list] Bitwise negation operator? Brian Hurt
@ 2003-02-21 23:16 ` Emmanuel Renieris
0 siblings, 0 replies; 2+ messages in thread
From: Emmanuel Renieris @ 2003-02-21 23:16 UTC (permalink / raw)
To: Brian Hurt; +Cc: Ocaml Mailing List
On Fri, Feb 21, 2003 at 05:12:32PM -0600, Brian Hurt wrote:
>
> Is there a bitwise negation operator I'm just missing? I'm looking for
> the equivelent of C's ~ operator.
lnot.
-- Manos
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-21 23:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-21 23:12 [Caml-list] Bitwise negation operator? Brian Hurt
2003-02-21 23:16 ` Emmanuel Renieris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox