Try keep variable types the same on source and destination. Extra type conversions takes time and makes errors possible. Especially if you have
[pascal]var
source: smallint;
dest: word;
begin
source:=-1;
dest:=source; // Now dest would be something over 30000 i guess
// or vice versa, unsigned to signed can result in number go negative
// or larger type to small type can make the value looping like with mod
end;[/pascal]
You know what i mean...

And your code seems valid.