[fpc-pascal] C# translatation

Sven Barth pascaldragon at googlemail.com
Sun Jan 8 23:04:21 CET 2017


On 08.01.2017 18:36, Bernd Oppolzer wrote:
> Am 08.01.2017 um 18:22 schrieb Sven Barth:
>>
>> Am 08.01.2017 17:32 schrieb "Bernd Oppolzer"
>> <bernd.oppolzer at t-online.de <mailto:bernd.oppolzer at t-online.de>>:
>> >
>> > Am 08.01.2017 um 11:46 schrieb Sven Barth:
>> >>
>> >> On 08.01.2017 10:55, Ryan Joseph wrote:
>> >>>
>> >>> I’m going to attempt to translate a perlin noise function (from
>> https://gist.github.com/Flafla2/f0260a861be0ebdeef76) but there are a
>> few things that stopped me from starting.
>> >>>
>> >>> 1) What is & doing in this assignment? I see this many places in
>> assignments.
>> >>>
>> >>> int h = hash & 15;
>> >>
>> >> That's an "and".
>> >
>> >
>> > Please keep in mind that & is a bitwise and in C
>> > whereas && is a logical and;
>> > this makes much difference and has to be implemented or converted
>> differently
>> > with Pascal, IMO.
>> >
>> > the closest equivalence to bitwise and in Pascal are set
>> intersections, IMO.
>>
>> The closest equivalence to bitwise and in Pascal is bitwise and.
>> The operators "and", "or", "xor" and "not" are logical or bitwise
>> depending on their arguments.
>>
>> Regards,
>> Sven
>>
>>
> 
> This depends on the Pascal compiler you use;
> the old Wirth "Standard" yields syntax errors, if you use and etc. on types
> other than boolean:

We're here on the FPC mailing list, so I personally only care about the
capabilities of FPC and that definitely supports bitwise operations (and
so do TP and Delphi).

Regards,
Sven



More information about the fpc-pascal mailing list