首页 \ 问答 \ 系统内存不足吗?(Is the system memory-less?)

系统内存不足吗?(Is the system memory-less?)

我有一个关于数字信号处理的问题。 是

h(n)= (2 n+5)u(n) 

内存少? 我认为因为u(n) ,系统是无记忆的。 我对吗?


I got a Question on digital signal processing. Is

h(n)= (2 n+5)u(n) 

memory-less? I think that the because of u(n), the system is memory-less. Am I right?


原文:https://stackoverflow.com/questions/29291749
更新时间:2024-03-11 21:03

最满意答案

移位并添加:

exModel = 0x2;
model = 0xE;

output = (exModel << 4) + model;

由于在上面的评论中提到过,你也可以使用联合,但我不会推荐它 - 它使代码非常不便携(并且我认为违反了严格的别名规则):

union myUnion
{
    unsigned char output;
    struct
    {
        unsigned char model   : 4; // the order of these two fields
        unsigned char exModel : 4; // is system dependent
    };
};

union myUnion u;

u.exModel = 0x2;
u.model = 0xE;

output = u.output;

Shift and add:

exModel = 0x2;
model = 0xE;

output = (exModel << 4) + model;

Since it was mentioned in the comment above, you could also use a union, but I wouldn't recommend it - it makes the code pretty nonportable (and I think violates strict aliasing rules):

union myUnion
{
    unsigned char output;
    struct
    {
        unsigned char model   : 4; // the order of these two fields
        unsigned char exModel : 4; // is system dependent
    };
};

union myUnion u;

u.exModel = 0x2;
u.model = 0xE;

output = u.output;

相关问答

更多
  • 我认为ImageMagick(或GraphicsMagick)可以使用-depth选项执行此操作。 这里有一个讨论: http : //www.imagemagick.org/discourse-server/viewtopic.php?f = 1&t = 15395 更新:我应该补充一点,ImageMagick不是一个PHP库,但是在http://pecl.php.net/package/imagick上有一个PECL包装器(imagick)。 In the end, despite the wonder ...
  • 当天, /和%的结果不是由C唯一定义的,而div()是出生的。 现在的商被截断为0。 unsigned数学没有这个问题,所以对udiv()需求较少。 现在许多编译器都可以识别附近的a/b和a%b计算并进行优化,从而减少对div() 。 建议只执行两次计算并让编译器优化它。 [编辑] 细节:在C99之前,分区可能会向0向INT_MIN截断,或者(也许可能最接近 - 我会研究它)。 无论如何, %是划分后的剩余部分。 div()被指定为只执行一个:用截断向0分割。对于C99, div()和/执行将商截断为0的除 ...
  • 你最好的选择可能是Reed Solomon Code 。 以下是对它们如何工作的非常好的解释, 这里有一些实际实现该算法的代码。 它没有评论得很好,抱歉。 一些谷歌行动会更多。 祝你好运。 Your best bet is probably a Reed Solomon Code. Here is a pretty good explanation of how they work, and here is some code that actually implements the algorithm. ...
  • 如果您确实需要您所说的内容(64位上的32位和64位32位),则需要使用宏。 但是你可能想要的只是使用size_t 。 编辑: size_t保证足够大,可以调整任何对象的大小并索引任何数组。 因此,64位上的32位和64位通常是32位。 所以它可能正是你想要的。 If you really want exactly what you said (32-bit on 32-bit and 64-bit on 64-bit) you'll need to use macros. But what you pro ...
  • 移位并添加: exModel = 0x2; model = 0xE; output = (exModel << 4) + model; 由于在上面的评论中提到过,你也可以使用联合,但我不会推荐它 - 它使代码非常不便携(并且我认为违反了严格的别名规则): union myUnion { unsigned char output; struct { unsigned char model : 4; // the order of these two fields ...
  • 带符号和无符号符号只是解释位模式的方式,而不是位模式本身。 所以如果只要你的整数在0到255范围内,你可以将它们堵塞成字节并将字节写入文件。 但是,由于Java将字节位模式解释为正在签名,因此在重新读入时必须小心。 例如,假设你有整数253 。 这是(完整的32位格式): 00000000000000000000000011111101 如果你这样做: int i = 253; byte b = (byte) i; 那么b将包含这些位: 11111101 如果你要求Java使用它,Java会声称它是- ...
  • #include uint64_t mul64(uint32_t x, uint32_t y) { return (uint64_t)x*(uint64_t)y; } #include uint64_t mul64(uint32_t x, uint32_t y) { return (uint64_t)x*(uint64_t)y; }
  • 来自C#规范: 枚举的已批准类型是byte , sbyte , short , ushort , int , uint , long或ulong 。 这些都不是4位类型。 你在C ++方面也有同样的问题。 From the C# spec: The approved types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong. None of these are 4-bit types. You'd have the ...
  • 您需要使用始终为64位而不是NSUInteger 。 您可以使用uint64_t或unsigned long long 。 您还需要从NSNumber中获取整数值(数组不能存储C类型)。 要做到这一点你需要打电话 uint64_t minID = [Ids.lastObject longLongValue]; 编辑 更改为在示例代码中使用uint64_t,因为它已被正确指出,这更好地显示了您的意图。 You need to use a type that is always 64 bit instead ...
  • 创建自己的从QObject派生的Integer64类,并为其提供所需的功能,例如 class Integer64 : public QObject { Q_OBJECT public: // ... Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) QString value() const; void setValue(QString value); Q_INV ...

相关文章

更多

最新问答

更多
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • 电脑高中毕业学习去哪里培训
  • 电脑系统专业就业状况如何啊?
  • IEnumerable linq表达式(IEnumerable linq expressions)
  • 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
  • Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
  • 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
  • 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
  • 的?(The ? marks in emacs/haskell and ghc mode)
  • 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
  • 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
  • 悬停时的图像转换(Image transition on hover)
  • IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
  • 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
  • java分布式框架有哪些
  • Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
  • PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
  • 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
  • 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
  • typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
  • 武陟会计培训类的学校哪个好点?
  • 从链接中删除文本修饰(Remove text decoration from links)