<commit_before>REBOL [
	Title:   "Red/System code emitter base object"
	Author:  "<NAME>"
	File: 	 %target-class.r
	Rights:  "Copyright (C) 2011 <NAME>. All rights reserved."
	License: "BSD-3 - https://github.com/dockimbel/Red/blob/master/BSD-3-License.txt"
]

target-class: context [
	target: little-endian?: struct-align: ptr-size: void-ptr: none
	compiler: none									;-- just a short-cut
	verbose:  0										;-- logs verbosity level
	
	comparison-op: [= <> < > <= >=]
	
	opp-conditions: [
	;-- condition ------ opposite condition --
		overflow?		 not-overflow?
		not-overflow?	 overflow?			
		=				 <>
		<>				 =
		even?			 odd?
		odd?			 even?
		<				 >=
		>=				 <
		<=				 >
		>				 <=
	]
	
	opposite?: func [cond [word!]][
		first select/skip opp-conditions cond 2
	]

	align-to: func [value [integer!] size [integer!]][
		either zero? value // size [value][
			and value + size negate size
		]
	]

	to-bin8: func [v [integer!]][to char! 256 + v and 255]

	to-bin16: func [v [integer!]][reverse skip debase/base to-hex v 16 2]	;TBD: add big-endian support

	to-bin32: func [v [integer!]][reverse debase/base to-hex v 16]	;TBD: add big-endian support
	
	power-of-2?: func [n [integer!]][if zero? n - 1 and n [log-2 n]]<commit_msg>FIX: regression: missing to-integer conversion in power-of-2?<commit_after>REBOL [
	Title:   "Red/System code emitter base object"
	Author:  "<NAME>"
	File: 	 %target-class.r
	Rights:  "Copyright (C) 2011 <NAME>. All rights reserved."
	License: "BSD-3 - https://github.com/dockimbel/Red/blob/master/BSD-3-License.txt"
]

target-class: context [
	target: little-endian?: struct-align: ptr-size: void-ptr: none
	compiler: none									;-- just a short-cut
	verbose:  0										;-- logs verbosity level
	
	comparison-op: [= <> < > <= >=]
	
	opp-conditions: [
	;-- condition ------ opposite condition --
		overflow?		 not-overflow?
		not-overflow?	 overflow?			
		=				 <>
		<>				 =
		even?			 odd?
		odd?			 even?
		<				 >=
		>=				 <
		<=				 >
		>				 <=
	]
	
	opposite?: func [cond [word!]][
		first select/skip opp-conditions cond 2
	]

	align-to: func [value [integer!] size [integer!]][
		either zero? value // size [value][
			and value + size negate size
		]
	]

	to-bin8: func [v [integer!]][to char! 256 + v and 255]

	to-bin16: func [v [integer!]][reverse skip debase/base to-hex v 16 2]	;TBD: add big-endian support

	to-bin32: func [v [integer!]][reverse debase/base to-hex v 16]	;TBD: add big-endian support
	
	power-of-2?: func [n [integer!]][if zero? n - 1 and n [to integer! log-2 n]]
	
	;power-of-2?: func [n /local p][
	;	either n = shift/left 1 p: to integer! log-2 n [p][none]
	;]
{'fraction_non_alphanumeric': 0.1680545041635125, 'fraction_numerical': 0.02195306585919758, 'mean_word_length': 2.660664819944598, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4990943', 'n_tokens_mistral': 1171, 'n_tokens_neox': 977, 'n_words': 270}