diff -r 8df58b532ecb -r d4eaefc626ec src/HOL/Codegenerator_Test/Generate_Target_Bit_Operations.thy --- a/src/HOL/Codegenerator_Test/Generate_Target_Bit_Operations.thy Thu Jan 16 09:26:56 2025 +0100 +++ b/src/HOL/Codegenerator_Test/Generate_Target_Bit_Operations.thy Thu Jan 16 09:26:57 2025 +0100 @@ -60,4 +60,25 @@ test_code check in GHC test_code check in Scala +text \Checking the index maximum for \\SML\\ + +ML \ +fun check_max max = + let + val _ = IntInf.~>> (0, max); + val _ = \<^assert> ((IntInf.~>> (0, Word.+ (max, Word.fromInt 1)); false) handle Size => true) + in () end; +\ + +definition \check_max = ()\ + +code_printing constant check \ + (Eval) "check'_max Bit'_Shifts.word'_max'_index" + +definition \anchor = (Code_Target_Bit_Shifts.drop_bit, check_max)\ + +ML \ +\<^code>\anchor\; +\ + end