Patent ID: 7376936
Filing Date: 2008-05-20
Classification: G06F

Abstract:
1. A method of implementing in a portable manner, fixed-width data types where such fixed-width data types are not directly supported by a programming language, said method comprising the steps of; a) providing as inputs (i) a set U of required fixed-width data types that have to be implemented in which each fixed-width data type U.sub.k from the set U has a fixed-data type width of WU.sub.k; (ii) an ordered set B of basic data types that are directly supported by the said programming language, in which each basic data type B.sub.i from the set B has a data type width WB.sub.i and each data type width WB.sub.i+1 is greater than or equal to data type width WB.sub.i; and (iii) a set V having all possible data type widths WV.sub.j for every basic data type B.sub.i from the set B of basic data types; b) creating a generic data type G with two formal parameters consisting of an integer parameter and a data type parameter; c) for every combination of data type width WV.sub.j from the set V, and basic data type B.sub.i from the set B creating a specialized generic data type G.sub.ji having an integer parameter WVj and a data type parameter B.sub.i and providing a possible implementation within the specialized generic data types G.sub.ji for each required fixed-width data type U.sub.k from the set U by comparing the data type width WV.sub.j with data type width WU.sub.k for every required fixed width data types U.sub.k from the set U; d)(i) if data type width WV.sub.j is equal to the data type width WU.sub.k, implementing the required fixed-width data type U.sub.k by creating and mapping data type U.sub.k to data type B.sub.i; (ii) if data type width WV.sub.j is greater than the data type width WU.sub.k, implementing the required fixed-width data type U.sub.k by using a sub-range of basic data type B.sub.i; (iii) if data type width WV.sub.j is lesser than the data type width WU.sub.k and if B.sub.i is not the last basic data type form the set B, implementing the required fixed-width data type U.sub.k by mapping U.sub.k to the implementation of U.sub.k provided by the specialized generic data type G having the integer parameter WB.sub.i+1 and the data type parameter B.sub.i+1; and (iv) if data type width WV.sub.j is lesser than the data type width WU.sub.k and if B.sub.i is the last basic data type from set B, implementing the required fixed-width data type U.sub.k by using an array with the least required number of elements of basic data type B.sub.i or a record with least required number of fields of basic data type B.sub.i; and e) finally implementing the set U of required fixed-width data types U.sub.k by selecting from the above possible implementations a correct implementation for each required fixed data type U.sub.k of the set U of required fixed-width data types, by creating and mapping the required fixed-width data type U.sub.k to the implementation of U.sub.k provided by the specialized generic data type G having the integer parameter WB.sub.i and the data type parameter B.sub.1 wherein i, j, k and n are all positive integers.