taddset4.pp 586 B

1234567891011121314151617181920212223242526272829
  1. type
  2. TCompilerIntfFlag = (ifHasGuid,ifDispInterface,ifDispatch,ifHasStrGUID);
  3. TCompilerIntfFlags = set of TCompilerIntfFlag;
  4. procedure t(l: longint);
  5. begin
  6. writeln(hexstr(l,8));
  7. { exactly 3 bits must be set }
  8. l:=l and (l-1);
  9. if (l = 0) then
  10. halt(1);
  11. l:=l and (l-1);
  12. if (l = 0) then
  13. halt(2);
  14. l:=l and (l-1);
  15. if (l <> 0) then
  16. halt(3);
  17. end;
  18. var
  19. b:boolean;
  20. begin
  21. b:=true;
  22. t(longint([
  23. TCompilerIntfFlag(ord(ifHasGuid)*ord(b)),
  24. TCompilerIntfFlag(ord(ifHasStrGUID)*ord(b)),
  25. TCompilerIntfFlag(ord(ifDispInterface)*ord(b))
  26. ]));
  27. end.