Port system documentation updated

All the latest updates about the ZX Spectrum Next, Website and Forum News
seedy1812
Posts: 50
Joined: Tue May 30, 2017 11:31 am

Re: Port system documentation updated

Postby seedy1812 » Mon Nov 05, 2018 4:27 pm

should_draw_pixel(x,y) = ((x1 < x2) ^ ((x1 <= x) ^ (x <= x2))) && ((y1 < y2) ^ ((y1 <= y) ^ (y <= y2))) (^ is XOR, && is AND)

Does seem a bit expensive when you can easily do ( and its a lot easier to read )

should_draw_pixel(x,y) = (x >= x1 ) && (x <= x2 ) && ( y>=y1) && (y<=y2)

Ped7g
Posts: 12
Joined: Mon Jul 16, 2018 7:11 pm

Re: Port system documentation updated

Postby Ped7g » Mon Nov 05, 2018 8:02 pm

seedy1812 wrote:
Mon Nov 05, 2018 4:27 pm
should_draw_pixel(x,y) = ((x1 < x2) ^ ((x1 <= x) ^ (x <= x2))) && ((y1 < y2) ^ ((y1 <= y) ^ (y <= y2))) (^ is XOR, && is AND)

Does seem a bit expensive when you can easily do ( and its a lot easier to read )

should_draw_pixel(x,y) = (x >= x1 ) && (x <= x2 ) && ( y>=y1) && (y<=y2)
sounds like you completely missed the point of my formula to extend the behaviour of "x2 < x1" and/or "y2 < y1" case. Yours is probably how it is implemented now (and then any "x2 < x1" should reliably hide whole layer, i.e. can be documented like that, unless somebody will like my idea enough to reserve the right to introduce that in future, then documenting it as UB/reserved for this moment would work).


Who is online

Users browsing this forum: No registered users and 3 guests