Maybe like this?
Code:procedure Foo; var Mask, Index: LongWord; s: TMySet; begin s := [mtOne, mtTwo, mtSixteen]; Index := 1; Mask := 0; while Index <= Integer(High(TMyType)) do begin if TMyType(Index) in s then Mask := Mask or Index; Index := Index * 2; end; end;
Bookmarks