Skip to content

Create unsupported bitfield implementation#27390

Closed
jonahwilliams wants to merge 3 commits intoflutter:masterfrom
jonahwilliams:smi_size_issue
Closed

Create unsupported bitfield implementation#27390
jonahwilliams wants to merge 3 commits intoflutter:masterfrom
jonahwilliams:smi_size_issue

Conversation

@jonahwilliams
Copy link
Copy Markdown
Contributor

allows compiling flutter in environments without 64 bit ints.

@Hixie
Copy link
Copy Markdown
Contributor

Hixie commented Feb 1, 2019

test? (yes i'm aware that's going to be a yak shave of epic proportions...)

@jonahwilliams
Copy link
Copy Markdown
Contributor Author

Good news: plumbing require to do so is working its way through the engine:
flutter/engine#7660

I also need to confirm this compiles internally and in fuchsia-tree

@goderbauer goderbauer added the framework flutter/packages/flutter repository. See also f: labels. label Feb 5, 2019
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Unsupported.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doc comment is unhelpful.

/// Unsupported.
int get kMaxUnsignedSMI => throw UnsupportedError('Not supported in environments without 64 bit ints');

/// A BitField over an enum (or other class whose values implement "index").
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: first sentence should be its own paragraph.

/// See <https://www.dartlang.org/articles/numeric-computation/#smis-and-mints>
const int kMaxUnsignedSMI = 0x3FFFFFFFFFFFFFFF;

/// A BitField over an enum (or other class whose values implement "index").
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: first sentence should be its own paragraph.

/// the bits are filled with zeros.
///
/// The given length must be at most 62.
BitField.filled(int length, bool _) // ignore: avoid_unused_constructor_parameters
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

///
/// The given length must be at most 62.
BitField(int _length)
: assert(_length <= 62);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the 62 be a const here and below like in the other class?

// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// BITFIELD
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This heading comment seems kind of redundant now that it has its own file?

/// Unsupported.
int get kMaxUnsignedSMI => throw UnsupportedError('Not supported in environments without 64 bit ints');

/// A BitField over an enum (or other class whose values implement "index").
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the doc comments here and/or in the other implementation mention the conditions for when this thing is actually supported?

(I am also wondering how dartdocs deals with conditional imports? Does it only show the dart docs for one of the impls? If so, which one? Does this thing show up twice in dart docs now?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think they should show up at all, but I'll need to test it.

Either the conditionally imported file has the same API, or we're in a world of hurt. That would mean all documentation should be on the main (non-conditional) implementation. I'm not sure if that means we should leave stub comments or something on the conditional file.

@jonahwilliams
Copy link
Copy Markdown
Contributor Author

Turns out we don't need to do this quite yet

@jonahwilliams jonahwilliams deleted the smi_size_issue branch February 7, 2019 21:27
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants