Function toInt

Convert an unsigned integer to a signed 32-bit integer.

int toInt (
  ulong u
) pure nothrow @safe;

FORTRAN code typically uses 32-bit signed ints for things like array lengths. D array lengths, on the other hand, are uints in 32-bit mode, and ulongs in 64-bit mode. Use of this function is safer than inserting casts everywhere, because it checks that the given uint/ulong fits in an int. For efficiency, this check is disabled in release mode (which is a good reason to use this function over std.conv.to!int).