(unknown charset) Re: Unsigned integer math exists!

From: (unknown charset) [at]} <Wojtek>
Date: Mon, 17 Nov 2003 10:56:36 -0500 (EST)

----boundary-LibPST-iamunique-2112339573_-_-
Content-type: text/plain

Marc:

  this exchange illustrates one of my points, namely lack of app notes
concerning this tricky issue. The language does not have an explicit
provision for unigned math, which is badly needed sometimes. This cannot
be simply ignored, because reading foreign file formats or interfacing
with hardware cannot be done otherwise. Lacking explicit unsigned math
one has to resort to explicit bit manipulations, "*" and MOD operators,
etc, which is confusing to even seasoned programmers as you see from
this discussion. It seems like everybody who wrote a message on this topic
has been "grappling" or "was bitten" by this issue just like myself.
So this is not a trivial topic which we all simply overlooked in Chapter 1
of your docu. Quite conversely, when you look at the code snippets like
yours, they are raising doubts and "what if" questions. So this is not
trivial.

May I suggest that being an authority on this and other tricky issues
the OuS crew could write a short app note dealing with unsigned math?
This can be two or three pages explaining the problem and suggested
solutions. The app note does not have to be very formal. Just a few useful
code snippets and hints will do.

I further suggest there are a few more recurring questions which pop up
on this list from time to time. (Sort of "how do I....?" kind of
messages.) Each of these is a potential candidate for a one-page
app note on your website.

I hope this suggestion is not outlandish. I have heard from electronics
engineers more than once that the difference between a good product and
great product is mostly in the quality of support. Some companies
made history by designing a product and then they stayed thirty years
in business because of app notes which made everyone use their product.
The very first op-amp designed with two vacuum tubes was this sort of
history. I wish I could say the same of your product, which at this
point is good but not great in the above sense.

Thank you,

Wojtek Skulski skulski{([at]})nowhere.xy
On Mon, 17 Nov 2003, [iso-8859-1] Gérard Meunier wrote:

> > > Wojtek,
> > >
> > > what about this little snippet?
> > >
> > > VAR msb, lsb: BYTE; x: SHORTINT;
> > > msb, lsb := ...;
> > > x := SHORT(msb * 256 + lsb MOD 256)
> > >
> > > Cheers,
> > > Marc
> > > Oberon microsystems, Inc.
> > >
> > >
> >

> > Isn't there a problem when msb or lsb > 127? In that situation their sign
> > bit is set and they are treated as negative numbers. Or am I missing
> > something?
> >
> > Chris Burrows
> > CFB Software
>
> There is no problem, since a MOD b has the sign of b along the CP

> definition.
>
> Regards,
>
> Gérard
>
> --------------------------------------------
>
> To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
> blackbox-request{([at]})nowhere.xy
>
> To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
>
> Send any problem reports or questions related to this email list to the list owner at
> owner-blackbox{([at]})nowhere.xy
>
> Current posting policy:
>
> a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
>
> b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
>
>
>
>


--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.



----boundary-LibPST-iamunique-2112339573_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRl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XMgc3Vic2NyaWJlciBhbmQgZm9yd2Fy
ZCB5b3VyIHBvc3RpbmcgaW1tZWRpYXRlbHksIHdpdGhvdXQgY3JlYXRpbmcgYW55IG92ZXJoZWFk
LlxwYXINClxwYXINCmIpIElmLCBmb3Igc29tZSByZWFzb24sIHlvdSBjYW5ub3QgcG9zdCBmcm9t
IHRoZSBhZGRyZXNzLCBieSB3aGljaCB5b3UgYXJlIHN1YnNjcmliZWQsIHlvdXIgbWVzc2FnZSB3
aWxsIGJlIG1vZGVyYXRlZCB0byBhdm9pZCBzcGFtLiBQbGVhc2UgdW5kZXJzdGFuZCB0aGF0IG1v
ZGVyYXRpb24gd2lsbCBvZnRlbiBjYXVzZSBzb21lIGRlbGF5LCBpbiBwYXJ0aWN1bGFyIG92ZXIg
d2Vla2VuZHMgb3IgaG9seWRheXMuXHB9fQD/LoEn8RMhHw=


----boundary-LibPST-iamunique-2112339573_-_---
Received on Mon Nov 17 2003 - 16:56:36 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:02 UTC