[DDMD] Replace explicit integer narrowing with explicit casts (alternative)

Same thing as #2730 with the commits squashed together