Highlighted
##

The shift may also be for x number of bits, not necessarily for all bits.

Former Member

Absent Member.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2005-03-21
13:26

595 views

##
[archive] Bit Shifts

**[Migrated content. Thread originally posted on 08 March 2005]**

The shift may also be for x number of bits, not necessarily for all bits.

2 Replies

Highlighted
##

solution 1: use a C compiler

move numeric data to a binary type (comp-5, comp-x, unsigned-int)

create small dll accepting dword * parameter for value, dword * for shift. you can return the value as return code. This is easy but may have long term portability issues. rigging up 64 bit is of course also possible (and a little bit more work) usage pointer is a 64 bit binary type.

solution 2: the cobol way

may one small program with the linkage pretty much the same as above (plus the shift mode)

shift left:

evaluate shift

when 0 continue

when 1 multiply value by 2

when 2 multiply value by 4

[...]

since you don'y require wraparound this isn't too much work 🙂

Merlin

Former Member

Absent Member.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2005-03-21
13:36

##
RE: [archive] Bit Shifts

move numeric data to a binary type (comp-5, comp-x, unsigned-int)

create small dll accepting dword * parameter for value, dword * for shift. you can return the value as return code. This is easy but may have long term portability issues. rigging up 64 bit is of course also possible (and a little bit more work) usage pointer is a 64 bit binary type.

solution 2: the cobol way

may one small program with the linkage pretty much the same as above (plus the shift mode)

shift left:

evaluate shift

when 0 continue

when 1 multiply value by 2

when 2 multiply value by 4

[...]

since you don'y require wraparound this isn't too much work 🙂

Merlin

Highlighted
##

Thanks, Merlin, turns out I don't need the shifting right now.

Former Member

Absent Member.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2005-03-21
14:39

##
RE: [archive] Bit Shifts

Originally posted by MerlinM

solution 2: the cobol way

may one small program with the linkage pretty much the same as above (plus the shift mode)

shift left:

evaluate shift

when 0 continue

when 1 multiply value by 2

when 2 multiply value by 4

[...]

since you don'y require wraparound this isn't too much work 🙂

Merlin

Thanks, Merlin, turns out I don't need the shifting right now.