Skip to content

Add imaxdiv, wcscoll, getdtablesize #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2022
Merged

Conversation

izissise
Copy link
Contributor

Some added function implementation that are missing when compiling bash

@izissise
Copy link
Contributor Author

Fixed for contributing guidelines

Copy link
Owner

@jart jart left a comment

Choose a reason for hiding this comment

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

Thanks for sending this. Some review comments.

*/
int getdtablesize(void) {
// glibc says the result on WinXP is 2048
return 2048;
Copy link
Owner

Choose a reason for hiding this comment

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

Cool I didn't know about this function. The right thing to do here with cosmo is return g_fds.n.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh nice, I didn't know about g_fds.n, should be good now.

EXPECT_EQ(0, res.quot);
EXPECT_EQ(0, res.rem);

res = imaxdiv(INT64_MIN, -1);
Copy link
Owner

Choose a reason for hiding this comment

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

  1. INTMAX_MAX
  2. Why isn't this raising an arithmetic exception? It should.
int main(int argc, char *argv[]) {
  volatile intmax_t i, j;
  i = INTMAX_MIN;
  j = -1;
  i = i / j;
  return 0;
}

Copy link
Owner

Choose a reason for hiding this comment

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

Scratch that. According to GitHub Actions, it does raise SIGFPE. Good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops I meant not to overflow, I fixed the test

Copy link
Owner

@jart jart left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you so much!

@jart jart merged commit f155205 into jart:master Oct 5, 2022
G4Vi pushed a commit to G4Vi/cosmopolitan that referenced this pull request Jan 27, 2023
@G4Vi G4Vi mentioned this pull request Jan 27, 2023
jart pushed a commit that referenced this pull request Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants