comp.lang.ada
 help / color / mirror / Atom feed
* Logical operators with bitmasks
@ 1997-01-26  0:00 Paul Van Bellinghen
  1997-01-27  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Van Bellinghen @ 1997-01-26  0:00 UTC (permalink / raw)



I have an unusual Ada story to relate which still has me second
guessing myself. As I wrote in an earlier posting, I am new to the Ada
language (~6 mo.). 

I was on a job interview the other day and was asked by another
software engineer what I had done in Ada.
I explained that I had configured Rational's VADScross (Ada 83) kernel
and TDM to run on our target processor (IDT R4700) and EEPROM. The
kernel TDM, and user programs are all slotted to be loaded into
EEPROM. I explained that the EEPROM was a flash module which required
erasing the entire 64x64K sector before any memory locations within
the sector can be modified. Thus before the TDM can modify user memory
or perform break pointing, the entire sector where the memory
locations reside must be buffered, erased, and written back to with
the modified memory changed in the buffer. 

When I told him that I used a sector mask to determine the sector
boundary of the  EEPROM location(s) to be modified, he asked me how I
performed the masking. I told him that I used the "and" function. He
said that I couldn't have since the logical operators in Ada are only
used to operate on boolean types. However, I knew that I had debugged
that portion of the TDM on my desktop PC using GNAT.

I believe what happened was that GNAT is an Ada 95 compiler which
allows the logical operators to operate on modular types as a bit wise
operation. Thus,  for:

  C := A and B;

where

Type Internal_address is mod 2**32 
C,A : Internal_Address;
B : constant := 16#FF80_0000#;

applies the mask B  to the variable A.

However, while I have not debugged the TDM yet on the target
processor, it did use a.make of VADScross to compile without errors. I
can't explain why. 


Paul Van Bellinghen
Software Engineer
home: 914 737-6998
bus:  914 968-2500




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Logical operators with bitmasks
  1997-01-26  0:00 Logical operators with bitmasks Paul Van Bellinghen
@ 1997-01-27  0:00 ` Robert A Duff
  0 siblings, 0 replies; 2+ messages in thread
From: Robert A Duff @ 1997-01-27  0:00 UTC (permalink / raw)



In article <32ebd9db.14078958@NEWS.CLOUD9.NET>,
Paul Van Bellinghen <pvanbell@cloud9.net> wrote:
...

The logical operators are defined for Boolean, arrays-of-Boolean, and
(in Ada 95 only) modular types.  They can also be defined by the
programmer for any type.

- Bob




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-01-27  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-26  0:00 Logical operators with bitmasks Paul Van Bellinghen
1997-01-27  0:00 ` Robert A Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox