SDL-News: How to create a "modulus type"


Subject: SDL-News: How to create a "modulus type"
From: Bruneau, Sylver (sylver.bruneau#matranortel.com)
Date: Wed Feb 07 2001 - 14:14:55 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From "Bruneau, Sylver" <sylver.bruneau#MatraNortel.com> to sdlnews -----

Hello everybody !
I would like to create a newtype that can take values from 0 to 7 with 7+1 =
0.
Actually i use C code to implement modulo incrementation ( the code is like
i=(i+1)%n ) but i would like to implement this in a "all-in-SDL" way !
I tried to use a litteral that can take values from 0 to 7, but if the
variable is equal to 7, an incrementation lead to an "out of range" warning
because of a variable equal to 8.
I tried to use axioms and operators, but i didn't managed to get what i want
!

Anybody can help ?

Thanks.

--End text from "Bruneau, Sylver" <sylver.bruneau#MatraNortel.com> to sdlnews ---
For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT