Host introspection: Difference between revisions

Content deleted Content added
→‎{{header|C}}: Make lines not longer than 80 characters. Add "bits" label. Add cast to (int): printf uses %d, but I am not sure if that expression is an int, without the cast.
Rdm (talk | contribs)
J: simplify
Line 306: Line 306:


=={{header|J}}==
=={{header|J}}==
'''Method A''':


<lang j> ":&> (|: 32 64 ;"0 big`little) {"_1~ 2 2 #: 16b_e0 + a. i. 0 { 3!:1 ''
<lang j> IF64 {;:'little big'
32
little</lang>
little</lang>


Note that this mechanism is testing the interpreter, and not the OS or Hardware. (Though, of course, you cannot run a 64 bit interpreter on a machine that does not support it.)
'''Method B''':

<lang j> ((4*#) ,:&": little`big {::~ '7'={.) {: 3!:3 ] 33 b.~_1
32
little</lang>


=={{header|Java}}==
=={{header|Java}}==