Recent

Author Topic: [SOLVED] how to ranslate this macro  (Read 571 times)

Key-Real

  • Sr. Member
  • ****
  • Posts: 372
[SOLVED] how to ranslate this macro
« on: June 21, 2024, 01:52:52 pm »
how to ranslate this macro in pascal?
Code: Pascal  [Select][+][-]
  1. #define limitRange(x, l, h)     ((x)=((x)<(l)?(l):(x)>(h)?(h):(x)))
« Last Edit: June 21, 2024, 02:25:27 pm by Key-Real »

Fibonacci

  • Hero Member
  • *****
  • Posts: 615
  • Internal Error Hunter
Re: how to ranslate this macro
« Reply #1 on: June 21, 2024, 02:08:23 pm »
Code: Pascal  [Select][+][-]
  1. procedure limitRange(var x: integer; l, h: integer); inline;
  2. begin
  3.   if x < l then x := l
  4.   else if x > h then x := h;
  5. end;

Bart

  • Hero Member
  • *****
  • Posts: 5469
    • Bart en Mariska's Webstek
Re: how to ranslate this macro
« Reply #2 on: June 21, 2024, 02:10:44 pm »
We have EnsureRange() in Math unit for that?

Bart

 

TinyPortal © 2005-2018