Considering the Set Myset = [10,45,99], How can implement an efecient algorithm which permits me to determine the NUMBER OF ELEMENTS in Myset, i.e 3 ? Any help is apreciated.
Posted on 2001-07-05 16:31:00 by isma
Well i belive you can do this in TASM and MASM should be able to do it also :D My_Enum_type ENUM Floppy,CD_ROM,HDD,JAZZ,CDRW then define them: My_enum_data: My_Enum_type CD_ROM i guess SIZE My_Enum_type will return 1 (because its stored in a byte) but the real value of CDRW (the last element) should be 5 :) ie what you want... as 5 is the maximum enumerated element...
Posted on 2001-07-05 17:47:00 by BogdanOntanu
Thanks for the tip. However, Your solution calls for the WIDTH unary operator. This operator does not have equivalent in Deplhi nor in Deplhi Inline Assembler. Any idea about how i can transpose the WIDTH operator in Inline Assembler code ?
Posted on 2001-07-06 12:50:00 by isma_a
Will the size of these sets change at runtime? If so, WIDTH won''t have any meaning. I don''t know Delphi, but I once had this problem in Pascal. Pascal had a Set data type or structure, and functions for union, intersection, "contained in", and so on, but to get the number of elements you had to write your own routine! Anyway the number of elements must be part of that structure. So, if the structure of a set in Delphi is documented, and you can get the address of a set, then you can extract it''s width or (equivalently) it''s number of elements. If that''s not practical, you might define a set structure of your own, and write routines to make unions and intersections and so on.
Posted on 2001-07-07 02:11:00 by Larry Hammick