Skip to content

Conversation

@rei2hu
Copy link
Contributor

@rei2hu rei2hu commented Oct 22, 2018

Resolves #206.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

  • Read, understood, and followed the contributing guidelines, including the relevant style guides.
  • Read and understand the Code of Conduct.
  • Read and understood the licensing terms.
  • Searched for existing issues and pull requests before submitting this pull request.
  • Filed an issue (or an issue already existed) prior to submitting this pull request.
  • Rebased onto latest develop.
  • Submitted against develop branch.

Description

What is the purpose of this pull request?

This pull request:

  • Implements the imuldw function.

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.


@stdlib-js/reviewers

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Math Issue or pull request specific to math functionality. labels Oct 22, 2018
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rei2hu Just minor nitpicks, and then should be ready for merge!


#### imuldw( \[out,\] a, b )

> Multiplies two signed 32-bit integers and returns an array of two signed 32-bit integers which represents the 64-bit signed integer product.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Multiplies two signed 32-bit integers and returns an array of two signed 32-bit integers which represents the 64-bit signed integer product.
Multiplies two signed 32-bit integers and returns an array of two signed 32-bit integers which represents the 64-bit signed integer product.

var imuldw = require( '@stdlib/math/base/special/imuldw' );
```

#### imuldw( \[out,\] a, b )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### imuldw( \[out,\] a, b )
#### imuldw( \[out,] a, b )

Only the first bracket needs to be escaped.

@@ -0,0 +1,30 @@

{{alias}}( [out,] a, b )
Multiplies two unsigned 32-bit integers and returns an array of two
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Multiplies two unsigned 32-bit integers and returns an array of two
Multiplies two signed 32-bit integers and returns an array of two signed


{{alias}}( [out,] a, b )
Multiplies two unsigned 32-bit integers and returns an array of two
unsigned 32-bit integers which represents the 64-bit unsigned integer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unsigned 32-bit integers which represents the 64-bit unsigned integer
32-bit integers which represents the 64-bit signed integer product.

{{alias}}( [out,] a, b )
Multiplies two unsigned 32-bit integers and returns an array of two
unsigned 32-bit integers which represents the 64-bit unsigned integer
product.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
product.

You'll want to check that the lines are the proper width, but I believe the edits above should be correct.

t = ( ( la * hb ) + w2 ) >>> 0;
k = ( t >> 16 ) >>> 0;

out[0] = ( ( ha * hb ) + w1 + k ) | 0; // the higher 32 bits; convert to signed 32 bit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out[0] = ( ( ha * hb ) + w1 + k ) | 0; // the higher 32 bits; convert to signed 32 bit
out[ 0 ] = ( ( ha * hb ) + w1 + k ) | 0; // the higher 32 bits; convert to signed 32 bit

k = ( t >> 16 ) >>> 0;

out[0] = ( ( ha * hb ) + w1 + k ) | 0; // the higher 32 bits; convert to signed 32 bit
out[1] = ( ( t << 16 ) + w3 ) | 0; // the lower 32 bits; convert to signed 32 bit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out[1] = ( ( t << 16 ) + w3 ) | 0; // the lower 32 bits; convert to signed 32 bit
out[ 1 ] = ( ( t << 16 ) + w3 ) | 0; // the lower 32 bits; convert to signed 32 bit

"stdmath",
"mathematics",
"math",
"math.imuldw",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"math.imuldw",


fprintf( f, "\"expected\":[" );
for ( i = 0; i < len; i++ ) {
// write an unnamed array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// write an unnamed array

@kgryte
Copy link
Member

kgryte commented Oct 22, 2018

@rei2hu Would you mind pulling in the latest changes to develop to your PR? This should resolve build failures due to outdated dev dependencies. Thanks!

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rei2hu Thanks for working on this!

@kgryte
Copy link
Member

kgryte commented Oct 23, 2018

Will merge pending CircleCI. :)

@kgryte
Copy link
Member

kgryte commented Oct 23, 2018

The CircleCI failure is due to an unrelated flaky test. Merging... :)

@kgryte kgryte merged commit a3a40cc into stdlib-js:develop Oct 23, 2018
@rei2hu rei2hu deleted the imuldw branch October 23, 2018 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. Math Issue or pull request specific to math functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: add support for computing a double word product of two signed 32-bit integers

2 participants