Results 1 to 1 of 1

Thread: Defining new data-types

  1. #1

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Question Defining new data-types

    Code:
    public class UInt1024
    		{
    			uint value;
    
    			private UInt1024(uint value)
    			{
    				//
    				// TODO: Add constructor logic here
    				//
    				if(value < MinValue | value > MaxValue) throw new ArgumentException();
    				this.value = value;
    			}
    
    			public static implicit operator UInt1024(uint x)
    			{
    				return new UInt1024(x);
    			}
    
    			public static implicit operator uint(UInt1024 x)
    			{
    				return x.value;
    			}
    		}
    This defines a new data-type UInt1024. At this moment this
    only works like as an usual uint32 data-type.

    The value is always given as an uint and so the UInt1024
    result will also be equal to an uint.

    I now want to give the UInt1024 type a 1024-bit register
    to manage numbers. So the values have to be in another
    format too.

    Any ideas to this problem?

    thx!
    Last edited by vbzero; Aug 3rd, 2002 at 06:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width