Important: The information in this document is obsolete and should not be used for new development.
About Utility Functions
You can use Open Transport utility functions to measure time, manipulate memory, strings, and lists, and to perform atomic operations. These functions have proved useful in the implementation of Open Transport and they have been exported for your use and convenience. In some instances, they can prove more accurate or faster than equivalent functions provided by the operating system.This section summarizes the utility functions that are available to applications using Open Transport and explains what relative advantages they offer over their operating system equivalents, if any.
- Timing functions
You can use these functions to obtain the current time, to measure elapsed time, to find the sum or difference between two timestamp values, and to convert timestamp values into microseconds or milliseconds.
These functions are faster and more accurate than their Time Manager equivalents; they are also more consistent with Open Transport internal timing measurements.
- Memory manipulation functions
You can use these functions to move memory, to compare two regions of memory, and to initialize memory ranges to set values.
For 68000 code, these functions are dispatched more quickly than their equivalent Toolbox functions. For PowerPC platforms, performance is roughly equivalent to Toolbox functions. Note that hese functions should be used for cached memory only. Using them for uncached memory will not return an error, but will degrade performance.
- Manipulating lists
You can use these functions to manipulate entries in FIFO (first-in first-out) and LIFO (last-in first-out) lists.
- Manipulating strings
You can use these functions to obtain the length of a string, to copy a string, to concatenate strings, and to determine whether two strings are equal. These functions are provided for those writing Open Transport modules and drivers (because these cannot be linked with standard C libraries) but you can also call these functions from application code.
- Using atomic operations
You can use these functions to test and clear bits, to compare and swap variously-sized values, and to add values. In addition, two atomic operations are provided that allow you to set and clear locks. These are described in "Locking Functions".
The equivalent of these functions are already available on some machines as part of the Driver Services Library. The advantage of using Open Transport atomic operations is that they are available on all platforms and don't depend on the avilability of the driver services library. For 68000 code, Open Transport atomic operations are in-lined and are, therefore, very fast.