bit manipulation

  • Thread starter Thread starter Juan Gabriel Del Cid
  • Start date Start date
Good thing this project isn't designed to be
compatible with VB.NET in the first place, or I would have to make an object
out of this and do everything by means of methods, which is not very
.NETish.

I think you have a misconception about software development... you don't
write an application in all the available languages that exist. You *use*
all the languages you have available.

In .Net you can write in any language you want and have it all be
compatible. For example, I once had a project where I needed to talk to
Excel, MQ Series and be a windows service. So, I used VB for the Excel
interop, managed C++ for the MQ Series bit and wrote the rest in C# (because
I love C#).

I hope that clears it up for you,
-JG
 
Greetings,

Thanks for helping me with some of the C# bit manipulation issues I've asked
about over the last couple days. I've got a first public preview of the
Binary8, Binary16, Binary32, and Binary64 classes I've worked on.

http://www.visualassembler.com/binary/

Use it like you would any other int, short, byte, whatever... I've
overloaded all but one of the operators (^ -- don't know how to do so).


Examples,

Binary8 bin = "10110100";
Binary16 bin = "1101";

Binary8 bin2 = bin << 3;
Binary64 bin3 = "10101";
Binary8 bin4 = bin3; // accepable because it doesn't exceed 8 bits

Binary8 bin = 0xFF;
Binary16 bin2 = ~bin;

if (bin > bin2) {
bin >>= 7;
}

bin2 = bin.RoateLeft(3);

if (bin2 != bin) {
bin2 = bin;
}

bin++;
bin *= "0101";

you get the picture...

optimizations wanted. There will be more updates, this is just a preview...

Thanks,
Shawn
 
Shawn B. said:
Greetings,

Thanks for helping me with some of the C# bit manipulation issues I've asked
about over the last couple days. I've got a first public preview of the
Binary8, Binary16, Binary32, and Binary64 classes I've worked on.

http://www.visualassembler.com/binary/

Use it like you would any other int, short, byte, whatever... I've
overloaded all but one of the operators (^ -- don't know how to do so).


Examples,

Binary8 bin = "10110100";
Binary16 bin = "1101";

Binary8 bin2 = bin << 3;
Binary64 bin3 = "10101";
Binary8 bin4 = bin3; // accepable because it doesn't exceed 8 bits

Binary8 bin = 0xFF;
Binary16 bin2 = ~bin;

if (bin > bin2) {
bin >>= 7;
}

bin2 = bin.RoateLeft(3);

if (bin2 != bin) {
bin2 = bin;
}

bin++;
bin *= "0101";

you get the picture...

optimizations wanted. There will be more updates, this is just a preview...

Thanks,
Shawn

It seems I can't get this to work in VB.NET, it won't allow me to assign the
object and none of the operators work. Guess it's a MC++, C# only solution.
Anyone have ideas how I can make it work in VB?


Thanks,
Shawn
 
One of the biggest marketing pushes for .NET is that if you write in one
language, they are compatible with other languages that target .NET. All
you have to do is create you're own type with an operator and all of the
sudden, you're not compatible with other languages that target .NET. I can
understand that VB.NET doesn't support operator overloading in its syntax,
but if I overload in MC++ or in C#, I would expect any other language to be
able to use that object, regardless whether it supports a syntax for
overloading its own operator. Good thing this project isn't designed to be
compatible with VB.NET in the first place, or I would have to make an object
out of this and do everything by means of methods, which is not very
..NETish.

So it seems only the intrinsic, int, long, bool, etc. are supported by
VB.NET in terms of using operators on them, and all non-MS objects are not
supported by VB?


Thanks,
Shawn
 
One of the biggest marketing pushes for .NET is that if you
write in one language, they are compatible with other languages
that target .NET. All you have to do is create you're own type
with an operator and all of the sudden, you're not compatible
with other languages that target .NET. I can understand that
VB.NET doesn't support operator overloading in its syntax, but
if I overload in MC++ or in C#, I would expect any other
language to be able to use that object, regardless whether it
supports a syntax for overloading its own operator. Good thing
this project isn't designed to be compatible with VB.NET in the
first place, or I would have to make an object out of this and
do everything by means of methods, which is not very .NETish.

So it seems only the intrinsic, int, long, bool, etc. are
supported by VB.NET in terms of using operators on them, and all
non-MS objects are not supported by VB?

Shawn,

Objects written in different .Net languages are compatible if they
follow the Common Language Specification (CLS) guidelines:

http://msdn.microsoft.com/library/en-
us/cpguide/html/cpconcommonlanguagespecification.asp

or

http://tinyurl.com/qiyg


Chris.
 
Back
Top